(()=>{"use strict";window.bcl=window.bcl||{},["c","u","s"].forEach(e=>bcl[e]=bcl[e]||{}),bcl.load=!!Object.prototype.hasOwnProperty.call(bcl,"load")&&bcl.load,bcl.preInit=bcl.preInit||[];let e={props:{currency:{market:"",current:"",rate:1,useComma:!1,useThousandsComma:!1},selectors:{priceItem:".c-price__value-JS",useComma:"mod--currency-decimal-comma",useThousandsComma:"mod--currency-thousands-comma",mainCurrenciesItems:"currency-item-js",mainCurrenciesItemsContainer:"currecy-items-container-js",currencyTitleJS:"currency-title-JS",blockedCurrencyButton:".blocked-currency-button-JS",blockedCurrencyTab:".tab-blocked-currency-JS",priceContainer:".c-price-JS",priceUnavailable:".c-price-unavailable-JS",priceFrom:".c-price-from-JS",parentPriceContainer:".c-price-container-JS",currencyFilter:"#currency-filter"},attributes:{localStorageCurrency:"barcelo_currency",localStorageCurrencyRate:"barcelo_currency_rate",defaultCurrency:"data-currency",localStorageCurrencyRelativeRate:"barcelo_currency_relative_rate"},picker:null,marketPriceClone:!1,mainCurrenciesContainer:!1,allMainCurrencies:!1,relativeRatesMap:null,marketRelativeRatesMap:null,isRelativePriceRequest:!1,shouldBeRelativePrice:!1,form:null,allCurrencies:null,allCurrencyLinks:null,currencyLinkSelector:".c-locale-form__currency",allCurrenciesSelector:".c-locale-form__currencies-all-JS",distributorCard:".distributor-card-JS",cardItem:".card-hotel-price-JS",mybPriceItem:".c-mybprice__value-JS",mybPriceItemContainer:".c-price-myb__container",priceItem:".c-price__value-JS"},init:function(){let e=document.querySelector("html").dataset.masterPageId||"";if(["home_eventos_santacatalina_classics"].some(o=>e.includes(o)))return void document.querySelectorAll(".brh-header__main-menu .brh-language-currency__currency").forEach(e=>e.remove());if(document.querySelectorAll(".brh-header__main-menu .brh-language-currency__currency").forEach(e=>e.classList.remove("hidden")),bcl.editMode)return;let o=document.querySelector("BODY");if(this.decrytPrices(o),bcl.u.utag.enableListener(),this.props.picker){let{picker:e}=this.props;for(let o of(e.addEventListener("change",()=>{let o=e.options[e.selectedIndex];this.changeCurrency(e.value,o.dataset.rate,o.title,null,o.dataset.relativerate)}),document.getElementsByClassName(this.props.selectors.currencyTitleJS)))o.innerHTML=this.props.picker.options[this.props.picker.selectedIndex].title}this.props.currency.useComma=bcl.u.containsClass(o,this.props.selectors.useComma),this.props.currency.useThousandsComma=bcl.u.containsClass(o,this.props.selectors.useThousandsComma),this.props.currency.market=o.getAttribute(this.props.attributes.defaultCurrency),this.props.marketRelativeRatesMap=o.dataset.marketrelativeratesmap?JSON.parse(o.dataset.marketrelativeratesmap)?.ratesMap:null;let t=localStorage.getItem(this.props.attributes.localStorageCurrency),l=localStorage.getItem(this.props.attributes.localStorageCurrencyRate);if(t===this.props.currency.market&&(localStorage.removeItem(this.props.attributes.localStorageCurrency),t=null),this.props.currency.current=this.props.currency.market,t)if(this.props.picker){this.props.picker.value=t;let e=this.props.picker.options[this.props.picker.selectedIndex];e&&this.changeCurrency(t,e.dataset.rate,e.title,!0)}else l&&this.changeCurrency(t,l,null,!0);else this.changeCurrentCurrencyMegamenu(this.props.currency.market);if(setTimeout(()=>this.blockedCurrencyChecker(),1e3),bcl.u.utag.isEnabled()&&window.utag_data.store_currency){let e=this.props.currency.current?.toLowerCase();bcl.u.utag.add({user_selected_currency:e})}if(bcl.u.utag.removeListener(),bcl.s={...bcl.s,currency:this},!this.props.picker){let e=document.querySelector(".locale-form-JS");e?.dataset.href&&bcl.ajax.getRequest(null,e.dataset.href,this.obtainTitleCurrency.bind(this))}this.initCurrencyFilter();let r=document.querySelector(".currency-dropdown-JS");r&&r.addEventListener("click",()=>this.watchCurrencyVisibility());let c=document.querySelector(".languageCurrencySelector .c-popover.container-contents-JS");if(c){let e=new MutationObserver(o=>{for(let t of o)if("attributes"===t.type&&"class"===t.attributeName&&t.target.classList.contains("mod--active")){let o=document.querySelector(".currencyForm-JS");o?.parentElement.scrollBy(0,-3e3),e.disconnect()}});e.observe(c,{attributes:!0})}},watchCurrencyVisibility(){let e=document.querySelector(".languageCurrencySelector .c-popover.container-contents-JS");if(!e)return;let o=new MutationObserver(e=>{e.forEach(e=>{if("attributes"===e.type&&"class"===e.attributeName&&e.target.classList.contains("mod--active")){let e=document.querySelector(".currencyForm-JS");e&&e.parentElement&&(e.parentElement.scrollBy(0,-3e3),o.disconnect())}})});o.observe(e,{attributes:!0})},obtainTitleCurrency:function(e){let o,t=localStorage.getItem(this.props.attributes.localStorageCurrency)||document.querySelector("BODY").dataset.currency,l=document.createElement("div");if(l.innerHTML=e.responseText,this.props.form=l.querySelector(".c-locale-form-JS"),this.props.form&&(this.props.allCurrencies=this.props.form.querySelector(this.props.allCurrenciesSelector),this.props.allCurrencies)){for(let e of this.props.allCurrencies.querySelectorAll(this.props.currencyLinkSelector))if(t===e.dataset.name){o=e.title;break}}for(let e of document.getElementsByClassName(this.props.selectors.currencyTitleJS))e.innerHTML=o},blockedCurrencyChecker:function(){let e=document.querySelector(this.props.selectors.blockedCurrencyButton);if(e){let o=e.dataset.value;o&&this.changeCurrency(o,this.props.currency.rate,null,!0)}},decrytPrices:function(e){let o={",":"A",".":"B",0:"C",1:"D",2:"E",3:"F",4:"G",5:"H",6:"I",7:"J",8:"K",9:"L"};(e||document).querySelectorAll(this.props.selectors.priceItem).forEach(e=>{e.textContent=(e=>{if("string"==typeof e)for(let[t,l]of Object.entries(o)){let o=RegExp(l,"g");e=e.replace(o,t)}return e})(e.textContent),bcl.u.removeClass(e,"hidden")})},parseTextPrice:function(e){if(!e)return 0;let o=parseFloat(e.replace(/\D/g,""));return isNaN(o)?(console.warn("Error on parsing price",e),0):o},formatPrice:function(e){if(isNaN(e))return console.warn("Invalid number for formatting:",e),e;let o=this.props.currency.useThousandsComma?",":".",t=RegExp("(\\d)(?=(\\d{3})+(?!\\d))","g");return e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2}).replace(/,/g,"X").replace(t,`$1${o}`).replace(/X/g,",")},changeCurrency:function(e,o,t,l,r){!l&&bcl.u.utag.isEnabled()&&window.utag_data.store_currency&&this.convertUtagPrices(e,o),this.props.currency.rate=o,this.props.currency.relativeRate=r||this.props.currency.relativeRate||o,e&&localStorage.setItem(this.props.attributes.localStorageCurrency,e),o&&localStorage.setItem(this.props.attributes.localStorageCurrencyRate,o),r&&localStorage.setItem(this.props.attributes.localStorageCurrencyRelativeRate,r);let c=document.querySelector("BODY");if(bcl.u.removeClass(c,`mod--${this.props.currency.current}`),bcl.u.addClass(c,`mod--${e}`),this.props.currency.current=e,this.props.shouldBeRelativePrice=this.props.isRelativePriceRequest&&bcl.c.hotelRoomList,this.convertPrices(),this.changeCurrentCurrencyMegamenu(e),bcl.c.distributor){let{results:e,comparator:o,map:t}=bcl.c.distributor,{$container:l,classNameContainerCard:r,nameAttrCard:c}=e.props;l&&l.querySelectorAll(`.${r}`).forEach(e=>{let l=e.getAttribute(c);[o.props.markers,t.props.markers].forEach(e=>{let o=e[l];o&&this.updateLabelPrice(o)})}),o.updateMap()}t&&document.querySelectorAll(`.${this.props.selectors.currencyTitleJS}`).forEach(e=>{e.innerHTML=t}),document.querySelector(".c-fastbooking__submenu-rooms.mod--active")||bcl.s.tabs.closeActive(this.props.isRelativePriceRequest)},updateLabelPrice:function(e){e&&bcl.c.distributor.map.updateLabelMarker("currency",e)},changeCurrentCurrencyMegamenu:function(e){let o=document.querySelector(".currency-current-JS");o&&(o.textContent=e)},convertUtagPrices:function(e,o){let t=e.toLowerCase(),l=window.utag_data.store_currency.toLowerCase();window.utag_data.user_selected_currency=t,t===l?window.utag_data.booking_price_exchange=window.utag_data.booking_price:window.utag_data.booking_price&&(window.utag_data.booking_price_exchange=this.setPriceRounded(o,window.utag_data.booking_price)),bcl.u.utag.push({store_currency:l,user_selected_currency:t,booking_price:window.utag_data.booking_price,booking_price_exchange:window.utag_data.booking_price_exchange})},setPriceRounded:function(e,o){let t=parseFloat(o)*e,l=Math.ceil(t);return(t>l?l+1:l).toString()},setRelativeRatesInOptions:function(e){let{$suggestedCurrencies:o=[],$allCurrencyLinks:t=[]}=bcl.c.localeConfigurationForm.props;[...o,...t].forEach(o=>{let t=bcl.u.closest(o,"label"),l=t?.querySelector("input");l&&(o.dataset.relativerate=e[l.value]?.rate||"")})},convertPrices:function(e){let o=e||document,t=bcl.c.hotelRoomList?`, ${bcl.c.hotelRoomList.props.mybPriceSelector}`:"";o.querySelectorAll(`${this.props.selectors.priceItem}${t}`).forEach(e=>{this.convertPriceElement(e)}),this.props.marketPriceClone=!0},convertPriceElement:function(e){if(e.dataset.marketPrice&&/^\d+$/.test(e.dataset.marketPrice)||(e.dataset.marketPrice=this.parseTextPrice(e.innerText)),e.dataset.marketPrice){let o=parseFloat(e.dataset.marketPrice);if(e.dataset.relativeprice=o,this.props.currency.current!==document.body.dataset.currency&&this.props.marketRelativeRatesMap){let t=this.props.marketRelativeRatesMap[this.props.currency.current]?.rate||1;e.dataset.relativeprice=Math.ceil(o*t)}e.innerText=this.formatPrice(e.dataset.relativeprice)}this.toggleUnavailablePrice(e)},convertToEur:function(e,o){return this.props.marketRelativeRatesMap?Math.ceil(e*this.props.marketRelativeRatesMap[o]?.inverse||1):e},toggleUnavailablePrice:function(e){if(e.dataset.marketPrice>0){let o=bcl.u.closest(e,this.props.selectors.priceContainer);if(o){bcl.u.removeClass(o,"hidden");let t=o.parentNode.querySelector(this.props.selectors.priceUnavailable);t&&bcl.u.addClass(t,"hidden");let l=bcl.u.closest(e,this.props.selectors.parentPriceContainer),r=l?.querySelector(this.props.selectors.priceFrom);r&&bcl.u.removeClass(r,"hidden")}}},convertAndFormatPrice:function(e){let o=Math.ceil(e*this.props.currency.rate);return this.formatPrice(o)},convertToMarketPrice:function(e,o){let t=o&&this.props.relativeRatesMap?this.props.relativeRatesMap[this.props.currency.market]?.rate:this.props.currency.rate;return this.formatPrice(Math.ceil(e*t))},evaluateRelativeMarketRate:function(e){let{relativeRates:o}=e;if(this.props.isRelativePriceRequest=!!o,o){let{ratesMap:e,base_currency:t}=o,{current:l}=this.props.currency;this.props.relativeRatesMap=e,this.props.currency.relativeMarket=t,this.props.currency.relativeRate=e[l]?.rate||null}},initMainCurrencies:function(){let e=document.querySelector(`.${this.props.selectors.mainCurrenciesItemsContainer}`);e&&(this.props.mainCurrenciesContainer=e,this.props.allMainCurrencies=Array.from(e.children),this.props.allMainCurrencies.forEach(e=>{e.addEventListener("click",o=>{o.preventDefault();let{value:t}=e.dataset,l=this.props.picker.querySelector(`[value="${t}"]`),r=this.props.picker.querySelector('[selected="selected"]');if(this.removeAllActiveCurrencies(),e.classList.add("mod--active"),l){this.props.picker.value=t,r&&r.removeAttribute("selected"),l.setAttribute("selected","selected"),bcl.u.triggerEvent(l,"change");let{rate:e,relativerate:o}=l.dataset;this.changeCurrency(t,e,null,null,o)}},!0)}))},removeAllActiveCurrencies:function(){this.props.allMainCurrencies.forEach(e=>{bcl.u.removeClass(e,"mod--active")})},changeMainCurrency:function(){if(!this.props.mainCurrenciesContainer||!this.props.picker)return;let e=this.props.picker.value,o=this.props.mainCurrenciesContainer.querySelector(`[data-value="${e}"]`);this.removeAllActiveCurrencies(),o&&bcl.u.addClass(o,"mod--active")},initCurrencyFilter:function(){let e=document.querySelector(this.props.selectors.currencyFilter);if(!e)return;e.addEventListener("input",e=>{this.filterCurrencyOptions(e.target)});let o=e.closest(".currency-select-JS"),t=o?Array.from(o.querySelectorAll("label")).filter(e=>""!==e.textContent.trim()):[];t.forEach(e=>{let o=e?.querySelector('input[name="currency"]'),l=o?.value===bcl.s.currency?.props?.currency?.current;o.checked=l,l&&bcl.u.addClass(e.parentElement,"checked"),o.addEventListener("change",e=>{t.forEach(e=>bcl.u.removeClass(e,"checked")),this.changeCurrency(e.target.value,e.target.dataset.rate,null,null),bcl.u.addClass(e.target.parentElement,"checked")})});let l=document.querySelector(".currency_JS"),r=document.querySelector(".currency_current");l&&bcl.u.addClass(l,"md:hidden"),r&&bcl.u.removeClass(r,"md:hidden")},filterCurrencyOptions:function(e){let o=e.value.toLowerCase(),t=e.closest(".currency-select-JS")?.querySelectorAll("label")||[];this.hideCurrencyOptions(t),this.showMatchedCurrency(e,o)},hideCurrencyOptions:function(e){e&&e.forEach(e=>bcl.u.addClass(e,"hidden"))},showMatchedCurrency:function(e,o){if(!e)return;let t=o?`input[data-name*='${o}' i], input[title*='${o}' i]`:"input";(e.closest(".currency-select-JS")?.querySelectorAll(t)||[]).forEach(e=>{let o=e.closest("label");o&&bcl.u.removeClass(o,"hidden")}),this.sortMatchedCurrency(e)},sortMatchedCurrency:function(e){if(!e)return;let o=e.nextElementSibling;if(!o)return;let t=Array.from(o.querySelectorAll("label")).sort((e,o)=>{let t=e.querySelector("input"),l=o.querySelector("input");if(t.checked&&!l.checked)return -1;if(!t.checked&&l.checked)return 1;let r=e.parentElement.classList.contains("hidden"),c=o.parentElement.classList.contains("hidden");if(r&&!c)return 1;if(!r&&c)return -1;let s=e.parentElement.classList.contains("currency-select-suggested"),a=o.parentElement.classList.contains("currency-select-suggested");return s&&!a?-1:!s&&a?1:0});o.innerHTML="",t.forEach(e=>o.appendChild(e))}};bcl.c.hotelRoomList={props:{fastbookingReadyHandler:null,cssSelector:"hotel-room-list",itemCssSelector:"c-hotel-room-list",headContainer:"c-head-hotel-info__booking-info",headSelector:"c-head-hotel-info__booking-info-price",headPriceUnavailableSelector:".JS-head-price-unavailable",elementSelector:"element-room-JS",priceSelector:".c-price__value-JS",hotelRoomSelector:".c-hotel-room-list-JS",priceSelectorMybCurrencyTypeWrapper:".c-price__curre-type-wrapper-JS",footerSelector:".c-hotel-room-list__footer",footerPriceSelector:".c-hotel-room-list__footer-price",footerUnavailableSelector:".c-hotel-room-list__footer-unavailable",bookingButtonSelector:".booking-button-JS",paginationClassName:"pagination-JS",hidePagClassName:"hidden",classAvailableFrom:"mod--available-from",closingHotelSelector:{node:"message-closing-hotel-JS",dayClosing:"day-date-closing-JS",monthClosing:"month-date-closing-JS",dayOpening:"day-date-opening-JS",monthOpening:"month-date-opening-JS",hotelName:"hotel-name-JS"},mybIconSelector:".myb-icon-JS",mybFooterSelector:".c-mybprice-JS",mybPriceSelector:".c-mybprice__value-JS",mybPriceClass:"c-mybprice__value-JS",strikePriceSelector:".c-price-normal-myb-JS",cleanRooms:!1,addClassName:"addClass",removeClassName:"removeClass",dataPrices:[],numberPagination:4,count:0,price:1e10,priceMyb:1e10,priceDom:0,priceMybDom:0,indexToPromise:0,rooms:{},dateOpen:null,firstLoad:!0,firstPageLoad:!0,hotelFinallyClosed:!0,hotelId:null,mybPrices:!1,msgBoxWrongConfig:"wrong-configuration-rooms-JS",fastBookingMsgBox:"limitPeopleMsgBox-JS",fastBookingMsgBoxOpened:!1,closeMsgBox:"closeMsgBoxWrongConfig-JS",receivedEvents:0,emittedEvents:0,hasFetched:!1,useOldAPI:!1,premiumSelectors:{premiumFiltersContainer:".js-premiums-filter-container",btnAll:".js-premium-all-btn",btnPremium:".js-premium-btn",roomListContainer:".hotel-room-list",roomItem:".c-hotel-room-list-JS",premiumRoomFlag:"js-premium-room",standarRoomsTitleContainer:".js-standar-title-container",premiumRoomsTitleContainer:".js-premium-title-container",active:"active",hidden:"hidden"},isPremiumLevelRoomsActive:!1,restrictions:{sabre:{maxAdultOccupancyExceeded:"MaxAdultOccupancyExceeded",maxChildOccupancyExceeded:"MaxChildOccupancyExceeded",noAvailableInventory:"NoAvailableInventory"},bconnect:{maxAdultOccupancyExceeded:"MAX_ADULT_OCCUPANCY_EXCEEDED",maxChildOccupancyExceeded:"MAX_CHILD_OCCUPANCY_EXCEEDED",open:"OPEN",closed:"CLOSED",minStay:"MIN_STAY",maxStay:"MAX_STAY",leadDays:"LEAD_DAYS_TIME",noArrival:"NO_ARRIVAL",noDeparture:"NO_DEPARTURE"}}},preInit:function(){bcl.u.docReady(bcl.c.hotelRoomList.initWhenFastbookingReady,!0)},isFastbookingReady:function(){return bcl?.c?.fastbooking?.props?.ready===!0},initWhenFastbookingReady:function(){let e=bcl.c.hotelRoomList;if(e.isFastbookingReady()){e.props.fastbookingReadyHandler=null,e.init();return}e.props.fastbookingReadyHandler||(e.props.fastbookingReadyHandler=function(){e.props.fastbookingReadyHandler=null,e.init()},window.addEventListener("fastbooking:ready",e.props.fastbookingReadyHandler,{once:!0}))},focusElement:function(e){return!(!e||"function"!=typeof e.focus||e.closest(".hidden, .mod--hidden")||e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled"))&&(e.focus(),document.activeElement===e)},restoreFastbookingFocus:function(){for(let e of[".c-fastbooking__submenu-rooms .add-JS",".c-fastbooking__submenu-rooms .apply-JS",".c-fastbooking__submenu-rooms .children-JS .inc-button-JS",".c-fastbooking__submenu-rooms .adults-JS .inc-button-JS"])if(this.focusElement(document.querySelector(e)))return},restartMessagesBox:function(){let e=document.querySelectorAll("."+bcl.c.hotelRoomList.props.msgBoxWrongConfig);e&&bcl.u.forEach(e,function(e){bcl.u.addClass(e,"hidden")});let o=document.querySelectorAll("."+bcl.c.hotelRoomList.props.fastBookingMsgBox);o&&bcl.u.forEach(o,function(e){bcl.u.removeClass(e,"hidden")})},handleLoadDataInit:function(e,o){event.preventDefault(),new Promise(e=>{bcl.c.hotelRoomList.updateOrder(bcl.c.hotelRoomList.props.dataPrices),e()}).then(()=>{setTimeout(function(){bcl.u.removeBhgLoading(document.querySelector("."+bcl.c.hotelRoomList.props.cssSelector)),bcl.c.hotelRoomList.orderNotAvailableRoomsByPriorities(),bcl.c.hotelRoomList.showWrongConfigBoxes(),bcl?.c?.fastbooking?.calendar?.roundedCalendarisEnabled?.()&&bcl.c.hotelRoomList.props.firstPageLoad&&bcl?.c?.fastbooking?.commonProps?.calendar?.obj?.getNights?.()==0&&(bcl.c.hotelRoomList.props.firstPageLoad=!1,bcl.c.fastbooking.showCalendar()),document.dispatchEvent(new CustomEvent("loadedAllData-SortRooms")),bcl.c.hotelRoomList.setupRecommendedMirror(e[0])},0)}).catch(function(e){o?.style.height&&(o.style.height="inherit"),console.error("ERROR PROMISE UPDATE ORDER ["+e+"]")})},init:function(){if(!document.querySelector(`.${bcl.c.hotelRoomList.props.cssSelector}`))return;if(!bcl.c.hotelRoomList.isFastbookingReady())return void bcl.c.hotelRoomList.initWhenFastbookingReady();bcl.c.hotelRoomList.initPremiumLevelFilter(),e.init(),bcl.c.hotelRoomList.restartMessagesBox(),document.querySelectorAll("."+bcl.c.hotelRoomList.props.closeMsgBox).forEach(function(e){e.addEventListener("click",function(){bcl.c.hotelRoomList.restartMessagesBox(),requestAnimationFrame(()=>{bcl.c.hotelRoomList.restoreFastbookingFocus()})})}),bcl.c.hotelRoomList.checkOldAPI(),bcl.u.utag.removeListener("hotel-room-list"),bcl.c.hotelRoomList.props.$container=document.querySelector("."+bcl.c.hotelRoomList.props.cssSelector)||null,bcl.u.utag.props.enabledListener.includes("hotel-room")||(bcl.u.utag.props.enabledListener.push("hotel-room"),bcl.u.utag.enableListener("general hotel-room")),bcl.c.hotelRoomList.props.$hotel=document.querySelector(".hotel-button-JS"),bcl.c.hotelRoomList.props.$hotel&&(bcl.c.hotelRoomList.props.hotelId=bcl.c.hotelRoomList.props.$hotel.dataset.hotel),bcl.c.hotelRoomList.props.$container&&(bcl.c.hotelRoomList.props.$messages=bcl.c.hotelRoomList.props.$container.querySelector("."+bcl.c.hotelRoomList.props.closingHotelSelector.node),bcl.c.hotelRoomList.props.$messages&&(bcl.c.hotelRoomList.props.mybPrices="true"===bcl.c.hotelRoomList.props.$messages.dataset.mybprices),bcl.c.hotelRoomList.initNodePagination()),bcl.c.hotelRoomList.props.mybPricesContainer=document.querySelector(bcl.c.hotelRoomList.props.mybPriceSelector);let o=bcl?.c?.fastbooking?.commonProps?.calendar?.data||{},t=!!(o.startDate&&o.endDate);if(t){let e=new Date(o.endDate);bcl.c.hotelRoomList.props.filterDateFB=!0,bcl.c.hotelRoomList.initSelectors(null,e)}else bcl.c.hotelRoomList.initSelectors();t&&bcl.c.hotelRoomList.initHead(),bcl.c.hotelRoomList.props.firstLoad=!1,bcl.c.hotelRoomList.initDateClosing(),bcl.c.hotelRoomList.initNodesClosing();let l=[];if(bcl.c.hotelRoomList.props.$container&&(l=bcl.c.hotelRoomList.props.$container.getElementsByClassName(bcl.c.hotelRoomList.props.itemCssSelector),bcl.c.hotelRoomList.cleanArticlesRoomsContainersToSort(l),bcl.c.hotelRoomList.props.numHotels=l.length,bcl.u.addBhgLoading(bcl.c.hotelRoomList.props.$container)),bcl.c.hotelRoomList.emittedEvents=0,bcl.c.hotelRoomList.receivedEvents=0,bcl.c.hotelRoomList.props.useOldAPI)Array.prototype.slice.call(l).forEach(function(e,o){bcl.c.hotelRoomList.initRoom(e,o),bcl.c.hotelRoomList.emittedEvents++});else if(bcl.c.hotelRoomList.props.selectors.startDate&&bcl.c.hotelRoomList.props.selectors.endDate&&bcl.c.hotelRoomList.props.$container)bcl.c.hotelRoomList.fetchRoomData(l);else if(bcl.c.hotelRoomList.props.$container){let e=bcl.c.hotelRoomList.getUTCTodayDate(),o=bcl.c.hotelRoomList.getDayFromToday(e,1);bcl.c.hotelRoomList.props.selectors.startDate=bcl.u.formatDate(e),bcl.c.hotelRoomList.props.selectors.endDate=bcl.u.formatDate(o),t?bcl.c.hotelRoomList.fetchRoomData(l):bcl.c.hotelRoomList.initRooms([],l)}else bcl.c.hotelRoomList.initRooms([],l);bcl.c.hotelRoomList.initPagination(l),0===l.length&&bcl.c.hotelRoomList.loadDataInHeadHotel();let r=document.querySelector(".hotel-room-recommended-container");r?.style.height&&(r.style.height="500px"),bcl.c.hotelRoomList.handleLoadDataInitComplete&&document.removeEventListener("loaded-all-data",bcl.c.hotelRoomList.handleLoadDataInitComplete),bcl.c.hotelRoomList.handleLoadDataInitComplete=function(){bcl.c.hotelRoomList.handleLoadDataInit(l,r)},document.addEventListener("loaded-all-data",bcl.c.hotelRoomList.handleLoadDataInitComplete),bcl.c.hotelRoomPage.props.firstLoad=!1,t||bcl.u.removeBhgLoading(bcl.c.hotelRoomList.props.$container)},initPremiumLevelFilter:function(){let e=bcl.c.hotelRoomList.props.premiumSelectors,o=document.querySelector(e.roomListContainer);if(!o)return;let t=o.querySelector(e.btnAll),l=o.querySelector(e.btnPremium),r=o.querySelectorAll(e.roomItem);if(!t||!l||!r.length)return;let c=o.querySelector(e.standarRoomsTitleContainer);bcl.c.hotelRoomList.props.isPremiumLevelRoomsActive=!0;let s=(o,t)=>{o.ariaPressed="true",o.classList.add(e.active),t.ariaPressed="false",t.classList.remove(e.active)},a=o=>{r.forEach(t=>{let l=t.classList.contains(e.premiumRoomFlag);o?t.classList.toggle(e.hidden,!l):t.classList.remove(e.hidden)})};t.addEventListener("click",()=>{s(t,l),c?.classList?.remove(e.hidden),a(!1)}),l.addEventListener("click",()=>{s(l,t),c?.classList?.add(e.hidden),a(!0)})},buildRoomAvailabilityParams:function(e){let o=Number.parseInt(e?.numberChildren,10)||0,t=e?.childrenAges,l=(Array.isArray(t)?t:"string"==typeof t&&t.length>0?t.split(","):[]).map(e=>String(e).trim()),r=l.length===o&&l.every(e=>""!==e&&"null"!==e&&/^\d+$/.test(e));if(o>0&&!r)return null;let c=new URLSearchParams({start_date:e?.startDate,end_date:e?.endDate,market:document.querySelector("body").getAttribute("data-ratefilter"),adults:e?.numberAdults,children:o});return o>0&&c.set("children_ages",l.join(",")),c},fetchRoomData:function(e){let o=bcl.c.hotelRoomList.buildRoomAvailabilityParams(bcl.c.hotelRoomList.props.selectors);o&&!bcl.c.hotelRoomList.props.hasFetched&&bcl.c.hotelRoomList.props.hotelId&&"undefined"!=bcl.c.hotelRoomList.props.hotelId&&(fetch(document.body.dataset.bconnectUrl.replace("[HOTEL_ID]",bcl.c.hotelRoomList.props.hotelId)+"/by-rooms?"+o.toString(),{headers:{"X-CBE-Customer-Currency":bcl.s.currency.props.currency.current}}).then(e=>e.json()).then(o=>{o.code?bcl.c.hotelRoomList.showErrorRooms():bcl.c.hotelRoomList.initRooms(o.rooms,e)}).catch(e=>console.error(e)),bcl.c.hotelRoomList.props.hasFetched=!0)},cleanArticlesRoomsContainersToSort:function(e){for(let o of e)bcl.u.removeClass(o,"notAvailableRoom-JS"),bcl.u.removeClass(o,"notAvailableRoomWithDate-JS"),o.dataset.opendatetimestamp="0",o.dataset.sortordernoavailableroom="0"},orderNotAvailableRoomsByPriorities:function(){let{$container:e,useOldAPI:o}=bcl.c.hotelRoomList.props;if(e)if(!0==bcl.c.hotelRoomList.props.isPremiumLevelRoomsActive){let t=bcl.c.hotelRoomList.props.premiumSelectors.premiumRoomFlag,l=e.querySelector(".web-fragment");if(!l)return;let r=e=>{let o=Number(e?.dataset?.opendatetimestamp);return isNaN(o)?0:o},c=(e,o,l)=>{let r=[];return e?.forEach(e=>{let c=e.closest(o);if(!c)return;let s=c.classList.contains(t);l&&s?r.push(c):l||s||r.push(c)}),r},s=(o,s=!0,a=!1,i,n)=>{let p=n?`.${t}`:`:not(.${t})`,m=e.querySelectorAll(o+p);0===m.length||(a&&(m=c(m,i,n)),[...m].sort((e,o)=>{let t=r(e),l=r(o);return s?t-l:l-t}).forEach(e=>{e.parentNode&&(n?e.parentNode.append(e):e.parentNode.insertBefore(e,l))}))},a=(e,o,l=!1,r,s)=>{let a=s?`.${t}`:`:not(.${t})`,i=document.querySelectorAll(e+a);return 0===i.length?o:(l&&(i=c(i,r,s)),i.forEach((e,t)=>{e.dataset.sortordernoavailableroom=o+t}),o+i.length)},i=o?".notAvailableRoom-JS:not(.notAvailableRoomWithDate-JS)":".c-hotel-room-list__footer-unavailable:not(.hidden)",n=o?"article.notAvailableRoom-JS":".c-hotel-room-list__footer-unavailable:not(.hidden)",p="article";s("article.notAvailableRoom-JS",!1,!1,null,!1),s("article.notAvailableRoomWithDate-JS",!0,!1,null,!1);let m=a(".notAvailableRoom-JS.notAvailableRoomWithDate-JS",1,!1,null,!1);a(i,m,!o,p,!1),s(n,!0,!o,p,!1),s("article.notAvailableRoom-JS",!1,!1,null,!0),s("article.notAvailableRoomWithDate-JS",!0,!1,null,!0);let d=a(".notAvailableRoom-JS.notAvailableRoomWithDate-JS",1,!1,null,!0);a(i,d,!o,p,!0),s(n,!0,!o,p,!0)}else{let t=(e,o)=>{let t=[];return e?.forEach(e=>{let l=e.closest(o);l&&t.push(l)}),t},l=(o,l=!0,r=!1,c)=>{let s=e.querySelectorAll(o);if(0===s.length)return;r&&(s=t(s,c));let a=e=>{let o=Number(e?.dataset?.opendatetimestamp);return isNaN(o)?0:o};[...s].sort((e,o)=>{let t=a(e),r=a(o);return l?t-r:r-t}).forEach(e=>e.parentNode?.append(e))},r=(e,o,l=!1,r)=>{let c=document.querySelectorAll(e);return 0===c.length?o:(l&&(c=t(c,r)),c.forEach((e,t)=>{e.dataset.sortordernoavailableroom=o+t}),o+c.length)};l("article.notAvailableRoom-JS",!1),l("article.notAvailableRoomWithDate-JS",!0);let c=r(".notAvailableRoom-JS.notAvailableRoomWithDate-JS",1);r(o?".notAvailableRoom-JS:not(.notAvailableRoomWithDate-JS)":".c-hotel-room-list__footer-unavailable:not(.hidden)",c,!o,".c-hotel-room-list-JS"),l(o?"article.notAvailableRoom-JS":".c-hotel-room-list__footer-unavailable:not(.hidden)",!0,!o,"article")}},showRoomsPopup:function(){let e=document.getElementById("rooms-fb");e&&setTimeout(function(){!1==bcl.c.hotelRoomList.props.fastBookingMsgBoxOpened&&(bcl.c.hotelRoomList.props.fastBookingMsgBoxOpened=!0,bcl.u.triggerEvent(e,"click"))},700)},showWrongConfigBoxes:function(){if(bcl.c.fastbooking){let e=document.querySelectorAll(".c-hotel-room-list__footer .booking-button-JS.hidden"),o=document.querySelector(".c-fastbooking .input-adult-JS"),t=o?parseInt(o.value):0,l=2*bcl.c.hotelRoomList.props.numHotels>e.length;if(e)for(let o=0;o=e)return l}},normalizeDateSelectorValue:function(e){let o=bcl?.c?.fastbooking?.calendar?.parseDate;return"function"==typeof o?o(e):e instanceof Date?"function"==typeof bcl?.u?.formatDate?bcl.u.formatDate(e):e.toISOString().slice(0,10):e},initSelectors:function(e,o){let t=bcl?.c?.fastbooking?.commonProps?.calendar?.data||{},l=bcl?.c?.fastbooking?.commonProps?.rooms||{};e=e?bcl.c.hotelRoomList.normalizeDateSelectorValue(e):t.startDate,o=o?bcl.c.hotelRoomList.normalizeDateSelectorValue(o):t.endDate,e&&o?bcl.c.hotelRoomList.props.useOldAPI?(bcl.c.hotelRoomList.props.selectors=e.replace(/-/gi,""),bcl.c.hotelRoomList.props.selectors+="."+o.replace(/-/gi,""),bcl.c.hotelRoomList.props.selectors+=l.valueAdults?"."+l.valueAdults:".2",bcl.c.hotelRoomList.props.selectors+=l.valueChildren?"."+l.valueChildren:".0",bcl.c.hotelRoomList.props.selectors+=l?.data?.rooms?"."+l.data.rooms:".1",bcl.c.hotelRoomList.props.selectors+=".json"):(bcl.c.hotelRoomList.props.selectors={},bcl.c.hotelRoomList.props.selectors.startDate=e,bcl.c.hotelRoomList.props.selectors.endDate=o,bcl.c.hotelRoomList.props.selectors.numberAdults=l.valueAdults||2,bcl.c.hotelRoomList.props.selectors.numberChildren=l.valueChildren||0,bcl.c.hotelRoomList.props.selectors.numberRooms=l?.data?.rooms||1,bcl.c.hotelRoomList.props.selectors.childrenAges=l.maxRoomChildrenAges):bcl.c.hotelRoomList.props.useOldAPI?bcl.c.hotelRoomList.props.selectors="json":(bcl.c.hotelRoomList.props.selectors={},bcl.c.hotelRoomList.props.selectors.noSelectors=!0,bcl.c.hotelRoomList.props.selectors.numberAdults=2,bcl.c.hotelRoomList.props.selectors.numberChildren=0,bcl.c.hotelRoomList.props.selectors.numberRooms=l?.data?.rooms||1)},initDateClosing:function(){let e=document.querySelector("."+bcl.c.hotelRoomList.props.closingHotelSelector.node);if(!e)return;let o=e.dataset.hotelclosing,t=e.dataset.hotelopening;if(bcl.c.hotelRoomList.props.$messageClosingHotel=e,o&&t){o=new Date(o),t=new Date(t),bcl.c.hotelRoomList.props.hotelclosing=o,bcl.c.hotelRoomList.props.hotelopening=t;let e=new Date;if(o<=e&&e<=t){let e=new Date(t);bcl.c.hotelRoomList.props.nowDateInClosing=!0,bcl.c.hotelRoomList.props.filterDateFB||(e.setMonth(e.getMonth()+3),bcl.c.hotelRoomList.initSelectors(t,e))}}},initNodesClosing:function(){if(bcl.c.hotelRoomList.props.filterDateFB){let e=new Date(bcl.c.fastbooking.commonProps.calendar.data.startDate);new Date(bcl.c.fastbooking.commonProps.calendar.data.endDate)>bcl.c.hotelRoomList.props.hotelclosing&&eArray.isArray(s)&&"string"==typeof s[e.getMonth()]?s[e.getMonth()]:e.toLocaleString("es",{month:"long"});o.innerText=bcl.c.hotelRoomList.props.hotelclosing.getDate(),t.innerText=a(bcl.c.hotelRoomList.props.hotelclosing),l.innerText=bcl.c.hotelRoomList.props.hotelopening.getDate(),r.innerText=a(bcl.c.hotelRoomList.props.hotelopening),c.innerText=e.dataset.name,bcl.u.removeClass(e,"invisible")},initNodePagination:function(){bcl.c.hotelRoomList.props.$pagination=bcl.c.hotelRoomList.props.$container.getElementsByClassName(bcl.c.hotelRoomList.props.paginationClassName)[0],bcl.c.hotelRoomList.props.numberPagination=bcl.c.hotelRoomList.props.$pagination.dataset.numbershow,!0==bcl.c.hotelRoomList.props.isPremiumLevelRoomsActive&&(bcl.c.hotelRoomList.props.numberPagination=100),bcl.c.hotelRoomList.props.$pagination.addEventListener("click",bcl.c.hotelRoomList.clickPagination)},initPagination:function(e){e.length<=bcl.c.hotelRoomList.props.numberPagination&&bcl.u.addClass(bcl.c.hotelRoomList.props.$pagination,"invisible")},clickPagination:function(){if(!0==bcl.c.hotelRoomList.props.isPremiumLevelRoomsActive)return;let e=bcl.c.hotelRoomList.props.$container.querySelectorAll("."+bcl.c.hotelRoomList.props.itemCssSelector+"."+bcl.c.hotelRoomList.props.hidePagClassName),o=e.length;for(bcl.u.addClass(bcl.c.hotelRoomList.props.$pagination,"invisible");0!=o;){bcl.u.removeClass(e[o-1],bcl.c.hotelRoomList.props.hidePagClassName);let t=e[o-1],l=bcl.c.flipcard&&bcl.c.flipcard.props?bcl.c.flipcard.props.selectorFlipCard:null,r=l?t.querySelector(l):null;r&&bcl.c.flipcard&&"function"==typeof bcl.c.flipcard.init&&bcl.c.flipcard.init(r),o--}bcl.u.triggerEvent(window,"cmp-image-global-redraw-all")},initHead:function(){let o,t=document.getElementsByClassName(bcl.c.hotelRoomList.props.headSelector);if(!0===bcl.c.hotelRoomList.props.mybPrices&&bcl.c.hotelRoomList.props.mybPricesContainer){o=document.getElementsByClassName("c-head-hotel-info__booking-info-price-myb"),bcl.u.removeClass(o[0],"hidden");let e=document.getElementsByClassName("c-myb-push-banner-JS");e.length>0&&bcl.u.removeClass(e[0],"hidden")}if(!t||!t[0])return void bcl.c.hotelRoomPage.initHeadRoomPage();bcl.c.hotelRoomList.props.$head=t[0],!0===bcl.c.hotelRoomList.props.mybPrices&&bcl.c.hotelRoomList.props.mybPricesContainer&&(bcl.c.hotelRoomList.props.$headMyb=o[0]);let l=bcl.c.hotelRoomList.props.useOldAPI,r=bcl.c.hotelRoomList.props.selectors.noSelectors&&!l||l&&"json"==bcl.c.hotelRoomList.props.selectors,c=bcl.c.hotelRoomList.props.$head.querySelector(".c-price__value");c&&!r&&bcl.c.hotelRoomList.props.firstLoad&&(bcl.c.hotelRoomList.props.priceDom=e.parseTextPrice(c.textContent)),bcl.u.addClass(bcl.c.hotelRoomList.props.$head.children[0],"invisible"),bcl.u.addClass(bcl.c.hotelRoomList.props.$head.children[1],"invisible"),bcl.u.addSpinner(t[0])},initRoom:function(e,o,t){let l=e.querySelector("."+bcl.c.hotelRoomList.props.elementSelector),r=bcl?.c?.fastbooking?.commonProps?.calendar?.data||{};if(bcl.u.addSpinner(l),bcl.c.hotelRoomList.props.count++,bcl.c.hotelRoomList.props.useOldAPI){let e=l.getAttribute("data-url");e=bcl.u.includes(e,"json")?e.replace(".json","."+bcl.s.currency.props.currency.current+".json"):e,"json"!==bcl.c.hotelRoomList.props.selectors?(e=e.replace("json",bcl.c.hotelRoomList.props.selectors),bcl.ajax.postRequest({url:e,callback:bcl.c.hotelRoomList.loadRoomsPrice,itemCallback:l,errorCallback:bcl.c.hotelRoomList.loadError})):(e=e.replace("json","html"),bcl.ajax.getRequest(null,e,bcl.c.hotelRoomList.loadRoomsPrice,l,null,bcl.c.hotelRoomList.loadError))}else bcl.c.hotelRoomList.loadRoomsPrice(t,e);r.startDate||r.endDate||(bcl.u.removeSpinner(l),0==parseInt(l.querySelector(bcl.c.hotelRoomList.props.priceSelector).innerHTML)&&bcl.c.hotelRoomList.showUnavailable(l.closest(bcl.c.hotelRoomList.props.hotelRoomSelector),bcl.c.hotelRoomList.props.addClassName,bcl.c.hotelRoomList.props.removeClassName)),o>=bcl.c.hotelRoomList.props.numberPagination&&bcl.u.addClass(e,bcl.c.hotelRoomList.props.hidePagClassName)},initRooms:function(e,o){let t=bcl?.c?.fastbooking?.commonProps?.calendar?.data||{},l=!0;Array.prototype.slice.call(o).forEach(function(o,r){let c=e.find(e=>e.id==o.dataset.roomcode);if(c&&c.rates?.average?.total&&c?.restriction?.status!="CLOSED"){l=!1;let e="gross"==document.querySelector("html").dataset.showtax?c.rates.average.total:c.rates.average.base;e.converted?(c.stdPrice=bcl.u.calculateDecimalsByExponent(e.converted.value,e.converted.exponent),c.stdBasePrice=bcl.u.calculateDecimalsByExponent(e.value,e.exponent)):c.stdPrice=bcl.u.calculateDecimalsByExponent(e.value,e.exponent)}if(bcl.c.hotelRoomList.initRoom(o,r,c),!t.startDate&&!t.endDate){l=!1;let e=o.querySelector(bcl.c.hotelRoomList.props.priceSelector);e&&!isNaN(e.textContent)&&parseFloat(e.textContent)>0&&bcl.c.hotelRoomList.setStatus(o,!0,!1)}bcl.c.hotelRoomList.emittedEvents++});let r=document.querySelector("."+bcl.c.hotelRoomList.props.headContainer);r&&(l?r.classList?.add("mod--price-hidden"):r.classList?.remove("mod--price-hidden"))},loadError:function(e){let o=bcl.u.containsClass(e,"c-header-detail__booking");bcl.c.hotelRoomList.notDataPrice(e,o)},showErrorRooms:function(){for(let e of Array.from(bcl.c.hotelRoomList.props.$container.getElementsByClassName(bcl.c.hotelRoomList.props.itemCssSelector)))bcl.c.hotelRoomList.loadError(e)},loadRoomsPriceByGet:function(e,o){bcl.c.hotelRoomPage.props.firstLoad?(bcl.c.hotelRoomPage.props.firstLoad=!1,bcl.c.hotelRoomPage.updateUrl()):bcl.c.hotelRoomList.loadRoomsPrice(e,o,!0),bcl.u.removeSpinner(o)},checkMinStay:function(e){return!e||!e.stdPrice||void 0===e.stdPrice.minStay||0==e.stdPrice.minStay||0>=parseInt(e.stdPrice.minStay)},checkLoadStatus:function(){bcl.c.hotelRoomList.receivedEvents++,bcl.c.hotelRoomList.emittedEvents==bcl.c.hotelRoomList.receivedEvents&&document.dispatchEvent(new CustomEvent("hotel-room-list-ready"))},loadRoomsPrice:function(e,o,t){!bcl.editMode&&e&&o&&new Promise(e=>{let o=setInterval(()=>{bcl.c.hotelRoomList.props.count--,clearInterval(o),e()},1e3)}).then(()=>{bcl.c.hotelRoomList.props.useOldAPI?bcl.c.hotelRoomList.loadRoomsPriceOldApi(e,o,t):bcl.c.hotelRoomList.loadRoomsPriceBconnect(e,o,t)}).catch(function(e){console.error("Error en promesa ("+e+")")})},loadRoomsPriceBconnect:function(e,o,t){let l=bcl.u.containsClass(o,"c-header-detail__booking"),r=!0,c=!1;bcl.c.hotelRoomList.props.$messages||(bcl.c.hotelRoomList.props.$messages=document.querySelector("."+bcl.c.hotelRoomList.props.closingHotelSelector.node));let s=o?.querySelector(".c-price__value");if(!e||e.errorApi||!e.rates||!e.rates.average||!e.rates.average.base||!e.rates.average.total)return void this.initNoDataOrPrice("data-no-available",o,l,t,!1);if(bcl.c.hotelRoomList.props.price=1e10,bcl.c.hotelRoomList.props.priceMyb=1e10,e.restriction?.status!=bcl.c.hotelRoomList.props.restrictions.bconnect.open){let r=bcl.c.hotelRoomList.restrinctionCases(e.restriction.status);this.initNoDataOrPrice(r,o,l,t,!0);return}if(e.minStay){let e=bcl.c.hotelRoomList.restrinctionCases(bcl.c.hotelRoomList.props.restrictions.bconnect.minStay);this.initNoDataOrPrice(e,o,l,t,!0);return}if(e.noArrival){let e=bcl.c.hotelRoomList.restrinctionCases(bcl.c.hotelRoomList.props.restrictions.bconnect.noArrival);this.initNoDataOrPrice(e,o,l,t,!0);return}r=bcl.c.hotelRoomList.setMinimumPrice(o,e),c=bcl.c.hotelRoomList.setMybFooterPriceOnRoomCard(o,e),l&&s&&this.handleUtagPriceData(s),bcl.c.hotelRoomList.setStatus(o,r,t,c),bcl.c.hotelRoomList.checkIndexPromise(),bcl.c.hotelRoomList.checkLoadStatus()},loadRoomsPriceOldApi:function(e,o,t){let l=bcl.u.containsClass(o,"c-header-detail__booking");if(!e||!e.response){bcl.c.hotelRoomList.notDataPrice(o,l,t),bcl.c.hotelRoomList.checkLoadStatus();return}let r=JSON.parse(e.response),c=!0,s=!1;if(bcl.c.hotelRoomList.props.$messages||(bcl.c.hotelRoomList.props.$messages=document.querySelector("."+bcl.c.hotelRoomList.props.closingHotelSelector.node)),r&&!r.errorApi){if(!r.stdPrice){bcl.c.hotelRoomList.notDataPrice(o,l,t),bcl.c.hotelRoomList.checkLoadStatus();return}if(bcl.s.currency.evaluateRelativeMarketRate(r),bcl.c.hotelRoomList.props.price=1e10,bcl.c.hotelRoomList.props.priceMyb=1e10,!bcl.c.hotelRoomList.checkMinStay(r)){bcl.c.hotelRoomList.props.hotelFinallyClosed=!1,bcl.c.hotelRoomList.noAvailable(o,"data-min-stay-message",t),bcl.c.hotelRoomList.checkIndexPromise(),bcl.c.hotelRoomList.checkLoadStatus();return}if(r.stdPrice.closed&&r.stdPrice.availableFrom){bcl.c.hotelRoomList.availableFrom(o,r.stdPrice.availableFrom,t),bcl.c.hotelRoomList.props.hotelFinallyClosed=!1,bcl.c.hotelRoomList.checkIndexPromise(),bcl.c.hotelRoomList.checkLoadStatus();return}if(r.stdPrice.closed)return void this.initnoDataOrPrice("data-no-available",o,l,t,!0);if(r.stdPrice.restrinction){let e=bcl.c.hotelRoomList.restrinctionCases(r.stdPrice.restrinction);bcl.c.hotelRoomList.props.hotelFinallyClosed=!1,bcl.c.hotelRoomList.noAvailable(o,e,t),bcl.c.hotelRoomList.checkIndexPromise(),bcl.c.hotelRoomList.checkLoadStatus();return}c=bcl.c.hotelRoomList.setMinimumPrice(o,r),s=bcl.c.hotelRoomList.setMybFooterPriceOnRoomCard(o,r);let e=o?.querySelector(".c-price__value");l&&e&&this.handleUtagPriceData(e)}else bcl.c.hotelRoomList.setNoPrice(o);bcl.c.hotelRoomList.setStatus(o,c,t,s),bcl.c.hotelRoomList.checkIndexPromise(),bcl.c.hotelRoomList.checkLoadStatus()},handleUtagPriceData:function(e){if(e){let o=e.dataset.marketPrice||e.innerText;bcl.u.utag.add({booking_price:o,booking_price_exchange:e.innerText,product_price:[o]})}bcl.u.utag.removeListener("hotel-room-list")},initNoDataOrPrice:function(e,o,t,l,r){bcl.c.hotelRoomList.noAvailable(o,e),bcl.c.hotelRoomList.notDataPrice(o,t,l),r&&bcl.c.hotelRoomList.checkIndexPromise(),bcl.c.hotelRoomList.checkLoadStatus()},restrinctionCases:function(e){let{restrictions:o,useOldAPI:t}=bcl.c.hotelRoomList.props,l=t?o.sabre:o.bconnect;return l&&new Map(l?[[l.maxAdultOccupancyExceeded,"data-restrinction"],[l.maxChildOccupancyExceeded,"data-restrinctionChild"],[l.noAvailableInventory,"data-no-available"],[l.closed,"data-no-available"],[l.minStay,"data-min-stay-message"],[l.maxStay,"data-no-available"],[l.leadDays,"data-no-available"],[l.noArrival,"data-no-available"],[l.noDeparture,"data-no-available"]].filter(([e])=>void 0!==e):[]).get(String(e))||"data-no-available"},checkIndexPromise(){bcl.c.hotelRoomList.props.indexToPromise===bcl.c.hotelRoomList.props.numHotels-1?document.dispatchEvent(new CustomEvent("loaded-all-data")):bcl.c.hotelRoomList.props.indexToPromise++},noAvailable:function(e,o,t){let l=bcl.c.hotelRoomList.props.$messages.getAttribute(o);bcl.c.hotelRoomList.writeMessage(e,l),bcl.c.hotelRoomList.props.useOldAPI?bcl.u.removeSpinner(e):bcl.u.removeSpinner(e.querySelector(bcl.c.hotelRoomList.props.footerSelector)),t?bcl.c.hotelRoomPage.showUnavailable(e,bcl.c.hotelRoomList.props.addClassName,bcl.c.hotelRoomList.props.removeClassName):(!bcl.c.fastbooking.commonProps.calendar.data.startDate&&!bcl.c.fastbooking.commonProps.calendar.data.endDate&&0==parseInt(e.querySelector(bcl.c.hotelRoomList.props.priceSelector).innerHTML)||bcl.c.fastbooking.commonProps.calendar.data.startDate&&bcl.c.fastbooking.commonProps.calendar.data.endDate)&&(bcl.c.hotelRoomList.showUnavailable(e,bcl.c.hotelRoomList.props.addClassName,bcl.c.hotelRoomList.props.removeClassName),parseInt(e.querySelector(bcl.c.hotelRoomList.props.priceSelector).innerHTML)>0&&bcl.u.removeSpinner(e))},hideMessageContainer:function(){let e=document.querySelector("html").dataset.template;if("brh-content"!==e&&"brh-hotel"!==e){let e=document.querySelector(".c-header-detail__message-JS");e&&bcl.u.addClass(e,"hidden")}},availableFrom:function(e,o,t){bcl.u.addClass(e,bcl.c.hotelRoomList.props.classAvailableFrom);let l=bcl.c.hotelRoomList.setOpenDateRoom(e,o),r=bcl.c.hotelRoomList.getOpenDateTimeStamp(o);if(r){let o=bcl.u.closest(e,bcl.c.hotelRoomList.props.hotelRoomSelector);o&&(o.dataset.opendatetimestamp=r,bcl.u.addClass(o,"notAvailableRoom-JS"),bcl.u.addClass(o,"notAvailableRoomWithDate-JS"))}(void 0==l.message||""===l.message)&&bcl.c.hotelRoomList.hideMessageContainer();let c="";c=o.day&&2==o.day.length&&o.day.startsWith("0")?o.day.split("0")[1]:o.day&&3==o.day.length&&o.day.startsWith("00")?o.day.split("00")[1]:o.day,bcl.c.hotelRoomList.writeMessage(e,l.message+" "+c+" "+l.month),bcl.c.hotelRoomList.setButtonNewListener(e),bcl.c.hotelRoomList.props.useOldAPI?bcl.u.removeSpinner(e):bcl.u.removeSpinner(e.querySelector(bcl.c.hotelRoomList.props.footerSelector)),t?bcl.c.hotelRoomPage.showUnavailable(e,bcl.c.hotelRoomList.props.addClassName,bcl.c.hotelRoomList.props.removeClassName):(!bcl.c.fastbooking.commonProps.calendar.data.startDate&&!bcl.c.fastbooking.commonProps.calendar.data.endDate&&0==parseInt(e.querySelector(bcl.c.hotelRoomList.props.priceSelector).innerHTML)||bcl.c.fastbooking.commonProps.calendar.data.startDate&&bcl.c.fastbooking.commonProps.calendar.data.endDate)&&(bcl.c.hotelRoomList.showUnavailable(e,bcl.c.hotelRoomList.props.addClassName,bcl.c.hotelRoomList.props.removeClassName),parseInt(e.querySelector(bcl.c.hotelRoomList.props.priceSelector).innerHTML)>0&&bcl.u.removeSpinner(e))},setButtonNewListener(e){let o=e.querySelector(".button-clone-JS");if(o){let e=o.parentNode.querySelector(".button-clone-JS").cloneNode(!0);o.parentNode.replaceChild(e,o),e.addEventListener("click",bcl.c.hotelRoomList.goToFastbooking)}},setOpenDateRoom(e,o){o.month&&o.month<=9&&(o.month="0"+o.month),o.day&&o.day<=9&&(o.day="0"+o.day),bcl.c.hotelRoomList.props.rooms[e.dataset.roomcode]=o.year+"-"+o.month+"-"+o.day,(!bcl.c.hotelRoomList.props.dateOpen||bcl.c.hotelRoomList.props.dateOpen.getMonth()0&&bcl.u.removeSpinner(e));bcl.c.hotelRoomList.props.useOldAPI?bcl.u.removeSpinner(e):bcl.u.removeSpinner(e.querySelector(bcl.c.hotelRoomList.props.footerSelector))},showMybFooterPrice:function(e){bcl.u.removeClass(e.querySelector(bcl.c.hotelRoomList.props.mybFooterSelector),"hidden"),bcl.u.removeClass(e.querySelector(bcl.c.hotelRoomList.props.bookingButtonSelector),"hidden")},hideMybFooterPrice:function(e){bcl.u.addClass(e.querySelector(bcl.c.hotelRoomList.props.mybFooterSelector),"hidden"),bcl.u.addClass(e.querySelector(bcl.c.hotelRoomList.props.bookingButtonSelector),"hidden")},showDefaultFooterPrice:function(e){bcl.u.removeClass(e.querySelector(bcl.c.hotelRoomList.props.footerPriceSelector),"c-price-normal-myb"),bcl.u.removeClass(e.querySelector(bcl.c.hotelRoomList.props.footerPriceSelector),"hidden"),bcl.u.removeClass(e.querySelector(bcl.c.hotelRoomList.props.bookingButtonSelector),"hidden");let o=e.querySelector(bcl.c.hotelRoomList.props.mybIconSelector);if(o){let e=o.dataset.tooltip;e.length>0&&document.querySelector(".c-popover."+e)&&bcl.u.removeClass(o,"hidden")}},hideDefaultFooterPrice:function(e){bcl.u.addClass(e.querySelector(bcl.c.hotelRoomList.props.footerPriceSelector),"c-price-normal-myb"),bcl.u.removeClass(e.querySelector(bcl.c.hotelRoomList.props.footerPriceSelector),"hidden"),bcl.u.addClass(e.querySelector(bcl.c.hotelRoomList.props.bookingButtonSelector),"hidden")},showUnavailable:function(e,o,t){let l,r=bcl.u.closest(e,bcl.c.hotelRoomList.props.hotelRoomSelector);if(bcl.u.addClass(r,"notAvailableRoom-JS"),!e)return;bcl.u[o](e.querySelector(bcl.c.hotelRoomList.props.footerPriceSelector),"hidden"),bcl.u[o](e.querySelector(bcl.c.hotelRoomList.props.mybFooterSelector),"hidden"),bcl.u[t](e.querySelector(bcl.c.hotelRoomList.props.footerUnavailableSelector),"hidden");let c=document.querySelector("html").dataset.template;if("brh-content"!==c&&"brh-hotel"!==c&&bcl.u[o](e.querySelector(bcl.c.hotelRoomList.props.bookingButtonSelector),"hidden"),l=bcl.c.hotelRoomList.props.useOldAPI?e.parentNode.querySelector(".c-container-image"):e.querySelector(".c-container-image"),bcl.u.containsClass(e,bcl.c.hotelRoomList.props.classAvailableFrom)){bcl.u[t](e.querySelector(".button-clone-JS"),"hidden"),bcl.u[t](l,"mod--img-disabled");return}bcl.u[o](l,"mod--img-disabled")},setNoPrice:function(e){let o=e.querySelector(".c-hotel-room-list__footer-price");bcl.u.addClass(o,"hidden");let t=e.querySelector(".booking-button-JS"),l=e.closest("article").querySelector(".c-hotel-room-list__body-title").href,r=t.cloneNode(!0);t.parentNode.replaceChild(r,t),r.children[0].setAttribute("href",l);let c=bcl.c.hotelRoomList.props.$messages.dataset.roomDetail;r.children[0].textContent=c},notDataPrice:function(e,o,t){o&&bcl.u.utag.removeListener("hotel-room-list"),bcl.c.hotelRoomList.props.useOldAPI?bcl.u.removeSpinner(e):bcl.u.removeSpinner(e.querySelector(bcl.c.hotelRoomList.props.footerSelector)),t?bcl.c.hotelRoomPage.showUnavailable(e,bcl.c.hotelRoomList.props.addClassName,bcl.c.hotelRoomList.props.removeClassName):(!bcl.c.fastbooking.commonProps.calendar.data.startDate&&!bcl.c.fastbooking.commonProps.calendar.data.endDate&&0==parseInt(e.querySelector(bcl.c.hotelRoomList.props.priceSelector).innerHTML)||bcl.c.fastbooking.commonProps.calendar.data.startDate&&bcl.c.fastbooking.commonProps.calendar.data.endDate)&&(bcl.c.hotelRoomList.showUnavailable(e,bcl.c.hotelRoomList.props.addClassName,bcl.c.hotelRoomList.props.removeClassName),parseInt(e.querySelector(bcl.c.hotelRoomList.props.priceSelector).innerHTML)>0&&bcl.u.removeSpinner(e)),bcl.c.hotelRoomList.props.indexToPromise===bcl.c.hotelRoomList.props.numHotels-1?(bcl.c.hotelRoomList.hotelFinallyClosed(),document.dispatchEvent(new CustomEvent("loaded-all-data"))):bcl.c.hotelRoomList.props.indexToPromise++},hotelFinallyClosed:function(){bcl.c.hotelRoomList.props.hotelFinallyClosed&&(bcl.c.hotelRoomList.props.hotelFinallyClosed=!1,bcl.c.hotelRoomList.hideZeroPrice())},setMinimumPrice:function(e,o){if(!o||!e)return;let t=e.querySelector(".c-price__value"),l=e.querySelector(bcl.c.hotelRoomList.props.mybPriceSelector);if(bcl.c.hotelRoomList.props.useOldAPI){let r,c,s,a,i;if(!1===bcl.c.hotelRoomList.props.mybPrices?(o.loyaltyPrice&&o.stdPrice?c=(a=o.loyaltyPrice.Amount||o.loyaltyPrice.AmountWithTaxesFees)>(i=o.stdPrice.Amount||o.stdPrice.AmountWithTaxesFees)||0===a?i:a:o.loyaltyPrice?c=o.loyaltyPrice.Amount||o.loyaltyPrice.AmountWithTaxesFees:o.stdPrice&&(c=o.stdPrice.Amount||o.stdPrice.AmountWithTaxesFees),s=0===c,r=0):(a=o.loyaltyPrice.Amount||o.loyaltyPrice.AmountWithTaxesFees,i=o.stdPrice.Amount||o.stdPrice.AmountWithTaxesFees,r=a,s=0===(c=i)&&0===r),!1===bcl.c.hotelRoomList.props.mybPrices&&!c)return;if(s)return!1;if(c=Math.ceil(c),r=Math.ceil(r),bcl.c.hotelRoomList.props.price>=c&&(bcl.c.hotelRoomList.props.price=c),bcl.c.hotelRoomList.props.priceMyb>=r)if(bcl.c.hotelRoomList.props.priceMyb=r,document.body.dataset.currency===o.relativeRates.currency)bcl.c.hotelRoomList.props.priceMybDom=bcl.c.hotelRoomList.props.priceMyb;else{let e=o.relativeRates.ratesMap[document.body.dataset.currency].rate;bcl.c.hotelRoomList.props.priceMybDom=bcl.c.hotelRoomList.props.priceMyb*e}c=c.toString(),r=r.toString(),bcl.c.hotelRoomList.props.dataPrices.push({node:e.parentNode,order:parseInt(e.parentNode.dataset.sortorder),value:parseFloat(c.split(".").join("")),valueMyb:parseFloat(r.split(".").join(""))});let n=o.relativeRates.ratesMap[document.body.dataset.currency].rate;return 0!=c&&(t.dataset.relativeprice=c,document.body.dataset.currency===o.relativeRates.currency?t.dataset.marketPrice=c:t.dataset.marketPrice=Math.ceil(c*n),t.innerText=bcl.s.currency.formatPrice(t.dataset.relativeprice)),0!=r&&(l.dataset.relativeprice=r,document.body.dataset.currency===o.relativeRates.currency?l.dataset.marketPrice=r:l.dataset.marketPrice=Math.ceil(r*n),l.innerText=bcl.s.currency.formatPrice(l.dataset.relativeprice)),!0}{if(!o.stdPrice||0==o.stdPrice)return!1;let r=Number(o.stdPrice),c=Number(o.stdBasePrice||o.stdPrice);bcl.c.hotelRoomList.props.dataPrices.push({node:e,order:parseInt(e.dataset.sortorder),value:r,valueMyb:r});let s=document.body.dataset.currency!==bcl.s.currency.props.currency.current,a=(e,o)=>{s&&(e.dataset.relativeprice=bcl.s.currency.formatPrice(o.toString()))};return t&&(t.innerText=bcl.s.currency.formatPrice(r.toString()),t.dataset.marketPrice=bcl.s.currency.formatPrice(c.toString()),t.dataset.relativeprice=bcl.s.currency.formatPrice(r.toString()),a(t,r)),l&&(l.innerText=bcl.s.currency.formatPrice(r.toString()),l.dataset.marketPrice=bcl.s.currency.formatPrice(c.toString()),l.dataset.relativeprice=bcl.s.currency.formatPrice(r.toString()),a(l,r)),bcl.c.hotelRoomList.props.price=Math.min(bcl.c.hotelRoomList.props.price,r),bcl.c.hotelRoomList.props.priceMarket=Math.min(bcl.c.hotelRoomList.props.priceMarket,c),bcl.c.hotelRoomList.props.priceMyb=Math.min(bcl.c.hotelRoomList.props.priceMyb,r),bcl.c.hotelRoomList.props.priceMarketMyb=Math.min(bcl.c.hotelRoomList.props.priceMarketMyb,c),!0}},setMybFooterPriceOnRoomCard:function(e,o){if(bcl.c.hotelRoomList.props.useOldAPI){if(!o||!e)return!1;let t=e.querySelector(bcl.c.hotelRoomList.props.mybFooterSelector),l=o.relativeRates?.currency,r=o.relativeRates&&o.relativeRates.ratesMap?o.relativeRates.ratesMap[document.body.dataset.currency]?.rate:null;if(o.loyaltyPrice&&o.stdPrice&&bcl.c.hotelRoomList.props.mybPrices&&bcl.c.hotelRoomList.props.mybPricesContainer){let c=o.loyaltyPrice.Amount||o.loyaltyPrice.AmountWithTaxesFees,s=o.stdPrice.Amount||o.stdPrice.AmountWithTaxesFees;if(c0){let o=t.querySelector(bcl.c.hotelRoomList.props.mybPriceSelector);o&&(o.innerHTML=c,!o.dataset.marketPrice&&(document.body.dataset.currency===l?o.dataset.marketPrice=c:r&&(o.dataset.marketPrice=Math.ceil(c*r))));let a=e.querySelector(bcl.c.hotelRoomList.props.strikePriceSelector+" "+bcl.c.hotelRoomList.props.priceSelector);return a&&(a.innerHTML=s,!a.dataset.marketPrice&&(document.body.dataset.currency===l?a.dataset.marketPrice=s:r&&(a.dataset.marketPrice=Math.ceil(s*r)))),!0}}return!1}{if(!o||!e)return!1;let t=o.stdBasePrice||o.stdPrice,l=bcl.s.currency.formatPrice(o.stdPrice.toString()),r=e.querySelector(bcl.c.hotelRoomList.props.mybFooterSelector).querySelector(bcl.c.hotelRoomList.props.mybPriceSelector);if(r)return r.innerHTML=l,r.dataset.marketPrice=bcl.s.currency.formatPrice(t.toString()),r.dataset.relativeprice=l,!0;let c=e.querySelector(bcl.c.hotelRoomList.props.strikePriceSelector+" "+bcl.c.hotelRoomList.props.priceSelector);return!!c&&(c.innerHTML=l,c.dataset.marketPrice=bcl.s.currency.formatPrice(t.toString()),c.dataset.relativeprice=l,!0)}},loadDataInHeadHotel:function(){if(!bcl.c.hotelRoomList.props.$head)return void bcl.c.hotelRoomPage.loadDataInHeadHotelRoom();if(bcl.c.hotelRoomList.props.$headPrice=bcl.c.hotelRoomList.props.$head.querySelector(bcl.c.hotelRoomList.props.priceSelector),!0===bcl.c.hotelRoomList.props.mybPrices&&bcl.c.hotelRoomList.props.mybPricesContainer&&(bcl.c.hotelRoomList.props.$headPriceMyb=bcl.c.hotelRoomList.props.$headMyb.querySelector(bcl.c.hotelRoomList.props.mybPriceSelector)),1e10!=bcl.c.hotelRoomList.props.price){if(document.body.dataset.currency===bcl.s.currency.props.currency.current)bcl.c.hotelRoomList.props.$headPrice.dataset.marketPrice=bcl.c.hotelRoomList.props.price;else if(bcl.s.currency.props.relativeRatesMap){let e=bcl.s.currency.props.relativeRatesMap[document.body.dataset.currency].rate;bcl.c.hotelRoomList.props.$headPrice.dataset.marketPrice=Math.ceil(bcl.c.hotelRoomList.props.price*e)}bcl.s.currency.toggleUnavailablePrice(bcl.c.hotelRoomList.props.$headPrice),bcl.c.hotelRoomList.props.$headPrice.dataset.marketPrice=bcl.c.hotelRoomList.props.priceMarket,bcl.c.hotelRoomList.props.$headPrice.dataset.relativeprice=bcl.c.hotelRoomList.props.price,bcl.c.hotelRoomList.props.$headPrice.innerText=bcl.s.currency.formatPrice(bcl.c.hotelRoomList.props.$headPrice.dataset.relativeprice)}else 0!==bcl.c.hotelRoomList.props.priceDom&&1e10!==bcl.c.hotelRoomList.props.priceDom&&(bcl.c.hotelRoomList.props.$headPrice.innerText=bcl.s.currency.formatPrice(bcl.c.hotelRoomList.props.priceDom),bcl.c.hotelRoomList.props.$headPrice.dataset.marketPrice=bcl.c.hotelRoomList.props.priceDom,bcl.s.currency.props.isRelativePriceRequest&&(bcl.c.hotelRoomList.props.$headPrice.dataset.relativeprice=bcl.c.hotelRoomList.props.priceDom));if(1e10!=bcl.c.hotelRoomList.props.priceMyb&&!0===bcl.c.hotelRoomList.props.mybPrices&&bcl.c.hotelRoomList.props.$headPriceMyb&&bcl.c.hotelRoomList.props.mybPricesContainer){bcl.u.containsClass(bcl.c.hotelRoomList.props.$headPriceMyb,"hidden")&&bcl.u.removeClass(bcl.c.hotelRoomList.props.$headPriceMyb,"hidden"),bcl.c.hotelRoomList.props.$headPriceMyb.dataset.marketPrice=Math.ceil(bcl.c.hotelRoomList.props.priceMybDom),bcl.c.hotelRoomList.props.$headPriceMyb.dataset.relativeprice=bcl.c.hotelRoomList.props.priceMyb,bcl.c.hotelRoomList.props.$headPriceMyb.innerText=bcl.s.currency.formatPrice(bcl.c.hotelRoomList.props.$headPriceMyb.dataset.relativeprice);let e=bcl.c.hotelRoomList.props.$headPriceMyb.parentElement,o=e?e.querySelector(bcl.c.hotelRoomList.props.priceSelectorMybCurrencyTypeWrapper):null;o&&bcl.u.removeClass(o,"hidden"),bcl.s.currency.props.isRelativePriceRequest?bcl.c.hotelRoomList.props.$headPriceMyb.dataset.relativeprice=bcl.c.hotelRoomList.props.priceMyb:bcl.s.currency.convertPrices(bcl.c.hotelRoomList.props.$headPriceMyb),bcl.c.hotelRoomList.setHotelHeadMybVisible()}bcl.u.removeClass(bcl.c.hotelRoomList.props.$head.children[0],"invisible"),bcl.u.removeClass(bcl.c.hotelRoomList.props.$head.children[1],"invisible"),bcl.u.removeSpinner(bcl.c.hotelRoomList.props.$head),bcl.c.hotelRoomList.updateUtagPriceData()},setHotelHeadMybVisible:function(){if(bcl.c.hotelRoomList.props.priceMyb&&bcl.c.hotelRoomList.props.price&&bcl.c.hotelRoomList.props.price>bcl.c.hotelRoomList.props.priceMyb){let e=bcl.c.hotelRoomList.props.$headMyb.querySelector(".tooltip-full-JS");e?.classList.contains("hidden")&&bcl.u.removeClass(e,"hidden"),bcl.c.hotelRoomList.props.$head.classList.contains("c-price-normal")&&(bcl.u.removeClass(bcl.c.hotelRoomList.props.$head,"c-price-normal"),bcl.u.addClass(bcl.c.hotelRoomList.props.$head,"c-price-normal-myb"));let o=bcl.c.hotelRoomList.props.$headMyb.querySelector(bcl.c.hotelRoomList.props.priceSelectorMybCurrencyTypeWrapper+".c-price__type");o?.classList.contains("hidden")&&bcl.u.removeClass(o,"hidden")}},updateUtagPriceData:function(){let e=bcl.c.hotelRoomList.props.$headPrice.dataset.marketPrice,o=bcl.c.hotelRoomList.props.$headPrice.innerText.split(".").join("");if(e?bcl.u.utag.add({booking_price:e,product_price:[e],booking_price_exchange:o}):bcl.u.utag.add({booking_price:o,product_price:[o]}),bcl.c.hotelRoomList.props.mybPrices){let e=parseInt(bcl.c.hotelRoomList.props.$headPriceMyb.innerText),o=parseInt(bcl.c.hotelRoomList.props.$headPrice.innerText);e&&!(e>=o)&&o||(document.querySelector(".switcher-close-btn-JS")?.click(),bcl.c.hotelRoomList.props.$headMyb.classList.add("hidden"))}},getListSorted:function(e,o){return e.sort(function(e,t){return e[o]>t[o]?-1:+(t[o]>e[o])})},getListSortedByRoom:function(e){let o=!1,t=document.querySelector(".hotel-room-list article[data-roomcode]").dataset.roomcode,l=document.querySelectorAll(".hotel-room-list article[data-roomcode]"),r=Array.prototype.slice.call(l,0).filter(e=>!e.classList.contains("hidden")),c=document.querySelector(".pagination-JS");null!=c&&void 0!=c&&c.click(),r.forEach(function(l){let r=l.dataset.roomcode;if(r==e&&void 0!=r){o=!0;let r=l.closest(".c-hotel-room-my-barcelo-price");if(t!=e){let e=document.querySelector(".hotel-room-list");e.append(r),e.insertBefore(r,e.children[0])}r.classList.contains("mod--highlighted-card")||r.classList.add("mod--highlighted-card")}}),o&&(window.utag.link({ga4_event_name:"perso_room_reorder",event:"perso_room_reorder",event_category:"adobe target",event_action:"EXP | home-hotel-room-reorder | V1 | Room Reorder | PF | CXO | Y",event_label:"si_perso"}),window.adobe.target.trackEvent({mbox:"reordenacionHabitaciones",params:{reordenableHabitaciones:"OK"}}))},checkIfFilter:function(e){let o=!1;if(document.querySelector("[data-roomcode]").dataset.roomcode!=e){let t=document.querySelectorAll("[data-roomcode]"),l=Array.prototype.slice.call(t,0).filter(e=>!e.classList.contains("hidden")),r=document.querySelector(".pagination-JS");null!=r&&void 0!=r&&r.click(),l.forEach(function(t){let l=t.dataset.roomcode;l==e&&void 0!=l&&(o=!0)}),o&&(window.utag.link({ga4_event_name:"perso_room_reorder",event:"perso_room_reorder",event_category:"adobe target",event_action:"EXP | home-hotel-room-reorder | V1 | Room Reorder | PF | CXO | Y",event_label:"no_perso"}),window.adobe.target.trackEvent({mbox:"reordenacionHabitaciones",params:{reordenableHabitaciones:"OK"}}))}},getListSortedByValue:function(){let e=document.querySelector("."+bcl.c.hotelRoomList.props.paginationClassName);null!=e&&void 0!=e&&e.click();let o=document.querySelectorAll(".c-hotel-room-list__footer-price"),t=Array.prototype.slice.call(o,0),l=t.filter(e=>!e.classList.contains("hidden")),r=t.filter(e=>e.classList.contains("hidden"));l.sort(bcl.c.hotelRoomList.higherValueFilter);for(let e=0;ebcl.c.hotelRoomList.addToParent(e)),window.utag.link({ga4_event_name:"perso_room_reorder",event:"perso_room_reorder",event_category:"adobe target",event_action:"EXP | home-hotel-room-reorder | V1 | Room Reorder | PF | CXO | Y",event_label:"si_perso"}),window.adobe.target.trackEvent({mbox:"reordenacionHabitaciones",params:{reordenableHabitaciones:"OK"}})},checkIfMVusersFilter:function(){let e=document.querySelector("."+bcl.c.hotelRoomList.props.paginationClassName);null!=e&&void 0!=e&&e.click();let o=document.querySelectorAll(".c-hotel-room-list__footer-price");Array.prototype.slice.call(o,0).filter(e=>!e.classList.contains("hidden")).length>0&&(window.utag.link({ga4_event_name:"perso_room_reorder",event:"perso_room_reorder",event_category:"adobe target",event_action:"EXP | home-hotel-room-reorder | V1 | Room Reorder | PF | CXO | Y",event_label:"no_perso"}),window.adobe.target.trackEvent({mbox:"reordenacionHabitaciones",params:{reordenableHabitaciones:"OK"}}))},higherValueFilter:function(e,o){let t=parseInt(e.querySelector(bcl.c.hotelRoomList.props.priceSelector).getAttribute("data-market-price")),l=parseInt(o.querySelector(bcl.c.hotelRoomList.props.priceSelector).getAttribute("data-market-price")),r=0;return l>t?r=1:l=1e3||o>=1e3)&&(r=-1),r},addToParent:function(e){let o=e.closest(".c-hotel-room-my-barcelo-price");document.querySelector(".hotel-room-list").append(o)},updateOrder:function(e){let o=bcl.c.fastbooking.commonProps.calendar.data.startDate&&bcl.c.fastbooking.commonProps.calendar.data.endDate?"value":"order";bcl.c.hotelRoomList.getListSorted(bcl.c.hotelRoomList.props.dataPrices,o);let t=document.querySelector("."+bcl.c.hotelRoomList.props.cssSelector);if(t){if(!0==bcl.c.hotelRoomList.props.isPremiumLevelRoomsActive){let o=bcl.c.hotelRoomList.props.premiumSelectors,l=t.querySelector(".web-fragment"),r=o.premiumRoomFlag,c=e.filter(e=>!e.node.classList.contains(r)),s=e.filter(e=>e.node.classList.contains(r)),a=t.querySelector(o.premiumFiltersContainer),i=bcl.c.hotelRoomList.props.hidePagClassName,n=bcl.c.hotelRoomList.props.useOldAPI;for(let e=0;e({...o,order:e.length-t-1}));for(let e=0;e article");if(!l)return;bcl.u.removeClass(l,bcl.c.hotelRoomList.props.hidePagClassName),r?bcl.c.hotelRoomList.props.useOldAPI?t.insertBefore(l,r):t.prepend(l):t.appendChild(l)}}if(bcl.c.hotelRoomList.props.dataPrices.length>0){let e=bcl.c.hotelRoomList.findMinPrice(bcl.c.hotelRoomList.props.dataPrices);if(bcl.c.hotelRoomList.props.price=null!==e?e.value:bcl.c.hotelRoomList.props.price,bcl.c.hotelRoomList.props.priceMyb=null!==e?e.valueMyb:bcl.c.hotelRoomList.props.priceMyb,bcl.c.hotelRoomList.props.priceMyb>bcl.c.hotelRoomList.props.price){let e=document.querySelector("."+bcl.c.hotelRoomList.props.headSelector);bcl.u.addClass(e,"c-price-normal"),bcl.u.removeClass(e,"c-price-normal-myb");let o=document.querySelector(".c-head-hotel-info__booking-info-price-myb");bcl.u.addClass(o,"hidden")}if(document.body.dataset.currency===bcl.s.currency.props.currency.current)bcl.c.hotelRoomList.props.priceMybDom=bcl.c.hotelRoomList.props.priceMyb;else if(bcl.s.currency.props.relativeRatesMap){let e=bcl.s.currency.props.relativeRatesMap[document.body.dataset.currency].rate;bcl.c.hotelRoomList.props.priceMybDom=bcl.c.hotelRoomList.props.priceMyb*e}}bcl.c.hotelRoomList.loadDataInHeadHotel(),bcl.c.hotelRoomList.hideRooms()}},findMinPrice:function(e){let o=1e10,t=null;return bcl.u.forEach(e,function(e){e.value&&e.value article");for(let o=0;o=bcl.c.hotelRoomList.props.numberPagination&&bcl.u.addClass(e[o],bcl.c.hotelRoomList.props.hidePagClassName)},getRoomsContainer:function(){return bcl.c.hotelRoomList.props.$container?bcl.c.hotelRoomList.props.$container:document.getElementsByClassName(bcl.c.hotelRoomList.props.cssSelector)[0]},hideZeroPrice:function(){"0"===bcl.c.hotelRoomList.props.$head.querySelector(bcl.c.hotelRoomList.props.priceSelector).textContent?bcl.u.addClass(bcl.c.hotelRoomList.props.$head,"hidden"):bcl.u.removeClass(bcl.c.hotelRoomList.props.$head,"hidden")},updateCards:function(){let e=bcl.c.hotelRoomList.getRoomsContainer();if(!e){bcl.c.hotelRoomPage.props.firstLoad||bcl.c.hotelRoomPage.updateUrl();return}let o=e.getElementsByClassName(bcl.c.hotelRoomList.props.itemCssSelector);o&&(bcl.c.hotelRoomList.props.hasFetched=!1,bcl.c.hotelRoomList.cleanCards(o,e),bcl.c.hotelRoomList.init())},initializeRoomsProps:function(e,o){bcl.c.hotelRoomList.props.indexToPromise=0,bcl.c.hotelRoomList.props.rooms={},bcl.c.hotelRoomList.props.numHotels=e.length,bcl.c.hotelRoomList.props.dataPrices=[],bcl.c.hotelRoomList.props.price=1e10;let t=bcl.c.hotelRoomList.props.$pagination?bcl.c.hotelRoomList.props.$pagination:o.getElementsByClassName(bcl.c.hotelRoomList.props.paginationClassName)[0];bcl.u.containsClass(t,"invisible")&&bcl.u.removeClass(t,"invisible")},updateCalendar:function(){bcl.c.fastbooking.calendar.applyRemoveAtAll([bcl.c.fastbooking.commonProps.calendar.dateCheckout,bcl.c.fastbooking.commonProps.calendar.dateCheckin]),bcl.c.fastbooking.calendar.addCookies()},updateRooms:function(){bcl.c.fastbooking.calendar.removeCookie(bcl.c.fastbooking.rooms.props.cookieName),bcl.c.fastbooking.calendar.addCookies()},cleanCards:function(e,o){bcl.c.hotelRoomList.initializeRoomsProps(e,o),bcl.c.fastbooking.calendar.updateOnlyCalendar?bcl.c.hotelRoomList.updateCalendar():bcl.c.hotelRoomList.updateRooms(),Array.prototype.slice.call(e).forEach(function(e){let o=e.querySelector("."+bcl.c.hotelRoomList.props.elementSelector);bcl.c.hotelRoomList.showUnavailable(o,bcl.c.hotelRoomList.props.removeClassName,bcl.c.hotelRoomList.props.addClassName),bcl.u.containsClass(o,bcl.c.hotelRoomList.props.classAvailableFrom)&&bcl.u.removeClass(o,bcl.c.hotelRoomList.props.classAvailableFrom);let t=document.querySelector("."+bcl.c.fastbooking.commonProps.fastbooking.selectors.hotelButton);bcl.u.containsClass(t,"mod--cta-disabled")&&t.disabled&&(bcl.u.removeClass(t,"mod--cta-disabled"),t.disabled=!1)})},recommendRoom:function(e){let o=document.querySelector(".hotel-room-recommended-container");o?.style.height&&(o.style.height="inherit");let t=e.cloneNode(!0);if(null!=o&&(o.childElementCount>0&&(o.innerHTML=""),o.childElementCount<=0)){let e=t.querySelector(".hotel-room-recommended-tag"),l=t.querySelectorAll(".hotel-room-recommended-size"),r=t.querySelectorAll(".c-hotel-room-list__body-text"),c=t.querySelectorAll(".c-hotel-room-list__body-persons div"),s=t.querySelector(".booking-button-JS"),a=document.querySelector(".c-stripemenu");t.classList.contains("notAvailableRoom-JS")||(a.classList.contains("mod--simple")&&o.closest(".c-container__grid-wrapper").classList.add("--new-max-width"),bcl.u.removeClass(e,"hidden"),bcl.u.removeClass(r[0],"md:block"),s?.classList.replace("mod--cta-secondary","mod--cta-primary"),bcl.u.mobile.isMobile()?(bcl.u.removeClass(l[0],"hidden"),bcl.u.addClass(c[0],"hidden")):(bcl.u.removeClass(l[1],"hidden"),bcl.u.addClass(c[1],"hidden")),o.appendChild(t))}},setupRecommendedMirror:function(e,o){if(o||(o=document.querySelector(".hotel-room-recommended-container")),!e||!o)return;o._barceloObserver&&(o._barceloObserver.disconnect(),o._barceloObserver=null);let t=()=>{if(!document.body.contains(o))return;o.style.height&&(o.style.height="inherit");let t=e.cloneNode(!0);o.innerHTML="";let l=t.querySelector(".hotel-room-recommended-tag"),r=t.querySelectorAll(".hotel-room-recommended-size"),c=t.querySelectorAll(".c-hotel-room-list__body-text"),s=t.querySelectorAll(".c-hotel-room-list__body-persons div"),a=t.querySelector(".booking-button-JS"),i=document.querySelector(".c-stripemenu");t.classList.contains("notAvailableRoom-JS")||(i&&i.classList.contains("mod--simple")&&o.closest(".c-container__grid-wrapper")?.classList.add("--new-max-width"),l&&bcl.u.removeClass(l,"hidden"),c[0]&&bcl.u.removeClass(c[0],"md:block"),a?.classList.replace("mod--cta-secondary","mod--cta-primary"),bcl.u.mobile.isMobile()?(r[0]&&bcl.u.removeClass(r[0],"hidden"),s[0]&&bcl.u.addClass(s[0],"hidden")):(r[1]&&bcl.u.removeClass(r[1],"hidden"),s[1]&&bcl.u.addClass(s[1],"hidden")),o.appendChild(t))};t();let l=new MutationObserver(()=>{t()});l.observe(e,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),o._barceloObserver=l},recommendRoomByCode:function(e){if(!e)return;let o=document.querySelector(".hotel-room-recommended-container");o&&o.childElementCount>0&&(o.innerHTML="");let t=bcl.c.hotelRoomList.props.$container.querySelector(`.${bcl.c.hotelRoomList.props.itemCssSelector}[data-roomcode="${e}"]`);t&&bcl.c.hotelRoomList.setupRecommendedMirror(t)},checkOldAPI:function(){bcl.c.hotelRoomList.props.useOldAPI=document.body.classList.contains("mod--enable-sabre-API")||"u">typeof utag_data&&window.utag_data?.hotel_country=="cuba"}},bcl.preInit.push(bcl.c.hotelRoomList.preInit),bcl.c.hotelRoomPage={props:{$headRoom:null,firstLoad:!0,orientativeMessage:".c-header-detail__booking-claim",unavailableMessage:".unavailable-content",price:".c-header-detail__booking-price",headWrap:".c-header-detail__booking-wrap",fastbookingReadyHandler:null,rangeDateEventName:null,rangeDateHandler:null},preInit:function(){bcl.u.docReady(bcl.c.hotelRoomPage.initWhenFastbookingReady,!0)},initWhenFastbookingReady:function(){let e=bcl.c.hotelRoomPage;if(bcl?.c?.fastbooking?.props?.ready===!0){e.props.fastbookingReadyHandler=null,e.init();return}e.props.fastbookingReadyHandler||(e.props.fastbookingReadyHandler=function(){e.props.fastbookingReadyHandler=null,e.init()},window.addEventListener("fastbooking:ready",e.props.fastbookingReadyHandler,{once:!0}))},init:function(){if(bcl?.c?.fastbooking?.props?.ready!==!0)return void bcl.c.hotelRoomPage.initWhenFastbookingReady();e.init(),bcl.c.hotelRoomPage.initHeadRoomPage();let o=bcl?.c?.fastbooking?.commonProps?.calendar?.evtchangeRangeDate;o&&bcl.c.hotelRoomPage.props.rangeDateEventName!==o&&(bcl.c.hotelRoomPage.props.rangeDateEventName&&bcl.c.hotelRoomPage.props.rangeDateHandler&&window.removeEventListener(bcl.c.hotelRoomPage.props.rangeDateEventName,bcl.c.hotelRoomPage.props.rangeDateHandler),bcl.c.hotelRoomPage.props.rangeDateEventName=o,bcl.c.hotelRoomPage.props.rangeDateHandler=function(){bcl.c.hotelRoomPage.updateUrl()},window.addEventListener(o,bcl.c.hotelRoomPage.props.rangeDateHandler))},initHeadRoomPage:function(){let e=document.querySelector(".c-header-detail__booking");e&&(bcl.c.hotelRoomList.props.$headRoom=e,bcl.u.addClass(bcl.c.hotelRoomList.props.$headRoom.children[1],"hidden"),bcl.c.hotelRoomPage.props.firstLoad&&(bcl.c.hotelRoomPage.props.firstLoad=!1,bcl.c.hotelRoomPage.updateUrl()))},loadDataInHeadHotelRoom:function(){bcl.c.hotelRoomList.props.$headRoom&&(bcl.c.hotelRoomList.props.$headPrice=bcl.c.hotelRoomList.props.$headRoom.querySelector(bcl.c.hotelRoomList.props.priceSelector),1e10!=bcl.c.hotelRoomList.props.price&&0!=bcl.c.hotelRoomList.props.price&&bcl.c.hotelRoomList.props.$headPrice&&(bcl.c.hotelRoomList.props.$headPrice.dataset.marketPrice=bcl.c.hotelRoomList.props.price,bcl.c.hotelRoomList.props.$headPrice.innerText=e.formatPrice(bcl.c.hotelRoomList.props.price),e.convertPrices(bcl.c.hotelRoomList.props.$headRoom),bcl.c.hotelRoomPage.showOrHideLayout(bcl.c.hotelRoomList.props.removeClassName)),bcl.u.removeSpinner(bcl.c.hotelRoomList.props.$headRoom))},updateUrl:function(){if(!bcl.c.hotelRoomList.props.$headRoom)return;bcl.c.hotelRoomPage.showOrHideLayout(bcl.c.hotelRoomList.props.addClassName),bcl.c.hotelRoomList.initSelectors();let o=bcl.c.hotelRoomList.props.$headRoom?.dataset.hotelId,t=bcl.c.hotelRoomList?.props?.selectors;if(!t?.startDate&&!document.body.classList.contains("mod--enable-sabre-syncro")){let e=document?.querySelector(bcl.c.hotelRoomPage.props.price)?.querySelector(".c-price-JS .c-price__value-JS");e?.innerText==0||isNaN(e?.innerText)?bcl.c.hotelRoomPage.showUnavailable(bcl.c.hotelRoomList.props.$headRoom,bcl.c.hotelRoomList.props.addClassName,bcl.c.hotelRoomList.props.removeClassName):bcl.c.hotelRoomPage.showOrHideLayout(bcl.c.hotelRoomList.props.removeClassName);return}if(!t?.startDate&&document.body.classList.contains("mod--enable-sabre-syncro")){let e=bcl.c.hotelRoomList.getUTCTodayDate(),o=bcl.c.hotelRoomList.getDayFromToday(e,1);bcl.c.hotelRoomList.props.selectors.startDate=bcl.u.formatDate(e),bcl.c.hotelRoomList.props.selectors.endDate=bcl.u.formatDate(o)}if(!t||!o||"undefined"===o)return;let l=bcl.c.hotelRoomList.buildRoomAvailabilityParams(t);if(!l)return;if(isNaN(o))return void bcl.c.hotelRoomPage.showOrHideLayout(bcl.c.hotelRoomList.props.addClassName);let r=document.body.dataset.bconnectUrl.replace("[HOTEL_ID]",o)+"/by-rooms?"+l.toString(),c={headers:{"X-CBE-Customer-Currency":e.props.currency.current}},s=bcl.c.hotelRoomList.props.$headRoom;bcl.u.addSpinner(s),fetch(r,c).then(e=>e.json()).then(e=>{(bcl.u.removeSpinner(s),e.code)?bcl.c.hotelRoomPage.showOrHideLayout(bcl.c.hotelRoomList.props.addClassName):bcl.c.hotelRoomPage.setPriceHeaderDetail(e.rooms)}).catch(e=>console.error(e))},replaceCurrencyUrl:function(o,t){if(e?.props.marketRelativeRatesMap&&e?.props.currency.current){let l=t[t.length-2];if(l&&Object.keys(e.props.marketRelativeRatesMap).includes(l)){let t=e.props.currency.current;if(l!=t)return o.replace("."+l,"."+t)}}return o},showOrHideLayout:function(e){let o=bcl.c.hotelRoomList.props.$headRoom;bcl.u[e](o.querySelector(bcl.c.hotelRoomPage.props.headWrap),"flex"),bcl.u[e](o.querySelector(bcl.c.hotelRoomPage.props.headWrap),"justify-center"),bcl.u[e](o.querySelector(bcl.c.hotelRoomPage.props.orientativeMessage),"hidden"),bcl.u[e](o.querySelector(bcl.c.hotelRoomPage.props.price),"hidden"),bcl.u.addClass(o.querySelector(bcl.c.hotelRoomPage.props.unavailableMessage),"hidden");let t=document.querySelector("html").dataset.template;"brh-content"!==t&&"brh-hotel"!==t&&bcl.u[e](o.querySelector(".booking-button-JS:not(.force-show-JS)"),"hidden")},showUnavailable:function(e,o,t){bcl.u[o](e.querySelector(bcl.c.hotelRoomPage.props.headWrap),"flex"),bcl.u[o](e.querySelector(bcl.c.hotelRoomPage.props.headWrap),"justify-center"),bcl.u[o](e.querySelector(bcl.c.hotelRoomPage.props.orientativeMessage),"hidden"),bcl.u[o](e.querySelector(bcl.c.hotelRoomPage.props.price),"hidden"),bcl.u[t](e.querySelector(bcl.c.hotelRoomPage.props.unavailableMessage),"hidden");let l=document.querySelector("html").dataset.template;"brh-content"!==l&&"brh-hotel"!==l&&bcl.u[o](e.querySelector(".booking-button-JS"),"hidden")},setPriceHeaderDetail:function(o){if(!bcl.c.hotelRoomList.props.$headRoom)return;let t=bcl.c.hotelRoomList.props.$headRoom.dataset.roomcode,l=o.find(e=>e.id==t),r=document.querySelector(bcl.c.hotelRoomPage.props.price).querySelector(".c-price-JS .c-price__value-JS");if(l.restriction.status==bcl.c.hotelRoomList.props.restrictions.bconnect.open){if(l&&l.rates?.average?.total){let o=l.rates.average.total;if(o.converted){let t=bcl.u.calculateDecimalsByExponent(o.converted.value,o.converted.exponent);r.innerText=e.formatPrice(t.toString())}else{let t=bcl.u.calculateDecimalsByExponent(o.value,o.exponent);r.innerText=e.formatPrice(t.toString())}}bcl.c.hotelRoomPage.showOrHideLayout(bcl.c.hotelRoomList.props.removeClassName)}else bcl.c.hotelRoomPage.showUnavailable(document.querySelector(".c-header-detail__booking"),bcl.c.hotelRoomList.props.addClassName,bcl.c.hotelRoomList.props.removeClassName)}},bcl.preInit.push(bcl.c.hotelRoomPage.preInit),bcl.c.tripadvisorDetails={props:{className:"c-tripadvisor-details",classNameIndividualReview:"individual-review-JS",classNameEmpty:"tripadvisor-details-empty-JS",classNameOpenModal:"open-modal-JS",classNameButtonModal:"button-modal-JS",classNameModal:"c-modal-inject",classNameWebFragment:"trip-advisor-web-fragment-JS"},preInit:function(){bcl.u.docReady(bcl.c.tripadvisorDetails.init)},init:function(e){let o=e||document,t=o.getElementsByClassName(bcl.c.tripadvisorDetails.props.className),l=o.getElementsByClassName(bcl.c.tripadvisorDetails.props.classNameEmpty);bcl.u.forEach(t,bcl.c.tripadvisorDetails.buildModalEvents),bcl.u.forEach(l,bcl.c.tripadvisorDetails.hideComponent)},buildModalEvents:function(e){if(e.dataset.load)return;e.dataset.load="true";let o=e.getElementsByClassName(bcl.c.tripadvisorDetails.props.classNameIndividualReview)[0];o&&bcl.u.forEach(o.children,function(o,t){let l=o.getElementsByClassName(bcl.c.tripadvisorDetails.props.classNameOpenModal)[0];l?.addEventListener("click",function(){bcl.c.tripadvisorDetails.clickModal(e,o,t)})})},clickModal:function(e,o,t){bcl.c.tripadvisorDetails.props.$button||(bcl.c.tripadvisorDetails.props.$button=e.getElementsByClassName(bcl.c.tripadvisorDetails.props.classNameButtonModal)[0],bcl.c.tripadvisorDetails.props.$modal=e.getElementsByClassName(bcl.c.tripadvisorDetails.props.classNameModal)[0]),bcl.c.tripadvisorDetails.props.$button.dataset.href="#modal-tripadvisor_"+t,bcl.c.tripadvisorDetails.cleanChildren(bcl.c.tripadvisorDetails.props.$modal),bcl.c.tripadvisorDetails.props.$modal.appendChild(o.cloneNode(!0)),bcl.u.triggerEvent(bcl.c.tripadvisorDetails.props.$button,"click")},cleanChildren:function(e){e.children.length>0&&e.removeChild(e.children[0])},hideComponent:function(e){e.closest("div.generic-container")?.classList.add("hidden");let o=document.getElementsByClassName("c-stripemenu-wrapper-JS");o[0]?.querySelector("button[data-anchor-ref=opiniones]")?.classList.add("hidden"),bcl.c.tripadvisorDetails.showWebFragment()},showWebFragment:function(){let e=document.querySelector("."+bcl.c.tripadvisorDetails.props.classNameWebFragment);if(e){bcl.u.removeClass(e,"hidden");let o=document.querySelector("div[data-tripadvisor-error]"),t=e.closest(".c-container")?.querySelector(".cmp-title__text");o&&t&&(t.textContent=o.dataset.tripadvisorError)}}},bcl.preInit.push(bcl.c.tripadvisorDetails.preInit),bcl.c.hotelMap={props:{nameLatAttr:"data-location-lat",nameLngAttr:"data-location-lng",containerMap:null,preview:".map-preview-JS",$preview:null},preInit:function(){bcl.u.docReady(bcl.c.hotelMap.initEvent),bcl.map&&bcl.map.ready(bcl.c.hotelMap.init)},initEvent:function(){if(bcl.c.hotelMap.props.containerMap=bcl.map?document.querySelector(bcl.map.getSelectorAttr("hotel-map")):null,!bcl.c.hotelMap.props.containerMap)return;let e=bcl.c.hotelMap.props.containerMap.closest(".c-hotel-map");if(e){let o=e.querySelector(bcl.c.hotelMap.props.preview);if(o)bcl.c.hotelMap.generateImagePreview(o),o.addEventListener("click",bcl.c.hotelMap.triggerInitMap);else{let e=bcl.u.debounce(function(){bcl.u.isInViewport(bcl.c.hotelMap.props.containerMap)&&(window.removeEventListener("scroll",e),bcl.c.hotelMap.triggerInitMap())},250,null);window.addEventListener("scroll",e)}}},init:function(){if(!bcl.c.hotelMap.props.containerMap)return void bcl.u.removeBhgLoading(bcl.c.hotelMap.props.containerMap);let e=bcl.c.hotelMap.props.containerMap.getAttribute(bcl.c.hotelMap.props.nameLatAttr),o=bcl.c.hotelMap.props.containerMap.getAttribute(bcl.c.hotelMap.props.nameLngAttr),t=parseInt(bcl.c.hotelMap.props.containerMap.dataset.zoom);if(!e||!o)return void bcl.u.removeBhgLoading(bcl.c.hotelMap.props.containerMap);t||(t=12);let l=new window.google.maps.LatLng(e,o),r=l;if(!bcl.u.mobile.isMobile()){let l=360/Math.pow(2,t+8),c=-window.innerWidth/4;r=new window.google.maps.LatLng(e,l*c+parseFloat(o))}let c=new window.google.maps.Map(bcl.c.hotelMap.props.containerMap,{center:r,scrollwheel:!1,zoom:t,fullscreenControl:!1,minZoom:!1,maxZoom:!1,mapTypeControl:!1,streetViewControl:!1,zoomControl:!0,zoomControlOptions:{position:window.google.maps.ControlPosition.LEFT_BOTTOM},styles:bcl.map.props.mapStyles.defaultStyle});new window.google.maps.Marker({map:c,position:l,icon:new window.google.maps.MarkerImage("/content/dam/barcelo/commons/icons/statics/poi_blue.svg",null,null,null,new window.google.maps.Size(48,48))}),bcl.u.removeBhgLoading(bcl.c.hotelMap.props.containerMap)},triggerInitMap:function(e){bcl.u.addBhgLoading(bcl.c.hotelMap.props.containerMap,!0),bcl.map.init(),e.target&&(bcl.u.removeClass(bcl.c.hotelMap.props.containerMap,"hidden"),e.target.parentNode.removeChild(e.target))},generateImagePreview:function(e){bcl.c.hotelMap.setImagePreview(e),window.addEventListener("resize",function(){bcl.c.hotelMap.setImagePreview(e)})},setImagePreview:function(e){e&&(bcl.u.mobile.isMobile()?e.setAttribute("style","background-image:url("+e.dataset.imgmobile+");"):e.setAttribute("style","background-image:url("+e.dataset.img+");"))}},bcl.preInit.push(bcl.c.hotelMap.preInit),bcl.u.breakMobile=1024,bcl.u.breakMobilePlus=1025,bcl.c.gallery={props:{dynamicClass:".c-gallery.dynamicLoading",cssSelector:"c-gallery__item",common:"md:p-2",config:{onecol:{cssClass:["w-full"],renditions:['{"land":'+bcl.u.breakMobile+', "land":0}']},twocol:{cssClass:["w-full md:w-1/2","w-full md:w-1/2"],renditions:['{"land":'+bcl.u.breakMobile+', "land":0}','{"land":'+bcl.u.breakMobile+', "land":0}']},twocol21:{cssClass:["w-full md:w-2/3","w-full md:w-1/3"],renditions:['{"land":'+bcl.u.breakMobile+', "land":0}','{"land":'+bcl.u.breakMobile+', "square":0}']},twocol12:{cssClass:["w-full md:w-1/3","w-full md:w-2/3"],renditions:['{"land":'+bcl.u.breakMobile+', "square":0}','{"land":'+bcl.u.breakMobile+', "land":0}']},threecol:{cssClass:["w-full md:w-1/3","w-full md:w-1/3","w-full md:w-1/3"],renditions:['{"land":'+bcl.u.breakMobile+', "square":0}','{"land":'+bcl.u.breakMobile+', "square":0}','{"land":'+bcl.u.breakMobile+', "square":0}']}}},loadStyles:function(){bcl.u.loadStyleSheet("/etc.clientlibs/barcelo/clientlibs/clientlib-gallery.css",bcl.c.gallery.props.dynamicClass)},callback:function(e,o){let t;bcl.c.gallery.loadStyles();let l=o.getAttribute("data-gallery-template1"),r=o.getAttribute("data-gallery-template2");if(l&&r&&(t=o.getElementsByClassName(bcl.c.gallery.props.cssSelector),bcl.c.gallery.processRows(t,bcl.c.gallery.props.config[l],bcl.c.gallery.props.config[r])),!bcl.editMode&&(!t||!t.length)){let e=o.closest(".gallery");bcl.u.addClass(e,"hidden");let t=e.getElementsByClassName("gallery-anchor-JS")[0],l=document.querySelector('a[href="#'+t.dataset.anchor+'"]');if(l){let e=l.closest(".c-landmenu__textbutton");e&&bcl.u.addClass(e,"hidden")}}o.removeAttribute("data-gallery-template1"),o.removeAttribute("data-gallery-template2"),bcl.u.triggerEvent(o,"cmp-image-global-redraw")},processRows:function(e,o,t){bcl.c.gallery.loadStyles();let l=1,r=1,c=o.cssClass.length,s=t.cssClass.length;for(let a=0;ac&&(n=t),bcl.c.gallery.processRow(i,n,r),++l>c+s&&(l=1),r++,(n===o&&r>c||n===t&&r>s)&&(r=1)}},processRow:function(e,o,t){bcl.c.gallery.loadStyles(),bcl.u.addClass(e,o.cssClass[t-1]+" "+bcl.c.gallery.props.common),e.setAttribute("data-rendition-breakpoints",o.renditions[t-1])},beforeInject:function(e,o){if(!e.dataset.index)return;bcl.c.gallery.loadStyles();let t=e.dataset.index,l=bcl.u.htmlToDOMElement(o),r=l.getElementsByClassName("cmp-bhg-carousel");return bcl.u.forEach(r,function(e){e.setAttribute("data-index",t)}),l}}})(); //# sourceMappingURL=/etc.clientlibs/barcelo/clientlibs/clientlib-hotel/hotel.js.map